diff --git a/artwork/Dials/default/flightmode-status.svg b/artwork/Dials/default/flightmode-status.svg index dca4d213a..80935d0c3 100644 --- a/artwork/Dials/default/flightmode-status.svg +++ b/artwork/Dials/default/flightmode-status.svg @@ -14,7 +14,7 @@ height="80.827866" id="svg10068" version="1.1" - inkscape:version="0.47 r22583" + inkscape:version="0.48.1 r9760" sodipodi:docname="flightmode-status.svg" inkscape:export-filename="H:\Documents\Hobbies\W433\My Gauges\vbat-001.png" inkscape:export-xdpi="103.61" @@ -949,6 +949,94 @@ fx="29.77438" fy="7.0922189" r="25.380436" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/artwork/PFD/pfd.svg b/artwork/PFD/pfd.svg index a5daa9575..6313bf1df 100755 --- a/artwork/PFD/pfd.svg +++ b/artwork/PFD/pfd.svg @@ -14,7 +14,7 @@ height="707.56323" id="svg2" version="1.1" - inkscape:version="0.47 r22583" + inkscape:version="0.48.1 " sodipodi:docname="pfd.svg" style="display:inline" inkscape:export-filename="H:\Documents\Hobbies\OpenPilot\SVN\artwork\PFD-2.png" @@ -1561,6 +1561,52 @@ inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d" /> + + + + + + + - - - - - - - - - - - - - - 20 - 20 - - - - 10 - 10 - - - - 10 - 10 - - - - 20 - 20 - + transform="matrix(4.6362185,0,0,1.5267412,-1475.4746,-169.05952)" + id="g4280"> + + + + 10 + 10 + + + + + 20 + 20 + + + + + -10 + -10 + + + + + + + + + + + + + + + + + + + -20 + -20 + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2094,141 +2075,585 @@ id="tspan4328" sodipodi:role="line">GPS - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + inkscape:label="#g5089"> + id="angle-3"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + id="g7953"> + + + + + + + + + + + + + + + + + + + + inkscape:label="#path3779-1" + inkscape:connector-curvature="0" /> + inkscape:label="#path3779-7" + inkscape:connector-curvature="0" /> - - - - + inkscape:label="#g4577"> + + + style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:3.06858087;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" + inkscape:connector-curvature="0" /> + d="m 280.28409,30.123177 5.7832,0 7.54688,11.08789 0,-11.08789 5.83789,0 0,20.042968 -5.83789,0 -7.50586,-11.005859 0,11.005859 -5.82422,0 z" + inkscape:connector-curvature="0" /> + id="path6986" + inkscape:connector-curvature="0" /> + d="m -217.0715,43.535286 5.89258,-0.369141 c 0.12759,0.957038 0.38736,1.686204 0.77929,2.1875 0.63801,0.811202 1.54947,1.216801 2.73438,1.216797 0.8841,4e-6 1.56542,-0.207353 2.04394,-0.62207 0.47851,-0.414709 0.71776,-0.895503 0.71778,-1.442383 -2e-5,-0.519525 -0.22788,-0.984368 -0.6836,-1.394531 -0.45574,-0.410149 -1.51303,-0.797518 -3.17187,-1.16211 -2.71616,-0.610668 -4.653,-1.421865 -5.81055,-2.433593 -1.16667,-1.011707 -1.75,-2.30142 -1.75,-3.869141 0,-1.029932 0.2985,-2.002913 0.89551,-2.918945 0.597,-0.915998 1.49479,-1.636049 2.69336,-2.160156 1.19856,-0.524069 2.84146,-0.786113 4.92871,-0.786133 2.56118,2e-5 4.51398,0.476257 5.8584,1.428711 1.34438,0.952492 2.14418,2.46779 2.39941,4.545898 l -5.83789,0.341797 c -0.15496,-0.902329 -0.48081,-1.558578 -0.97754,-1.96875 -0.49675,-0.41014 -1.18263,-0.615218 -2.05762,-0.615234 -0.72006,1.6e-5 -1.26237,0.152685 -1.62695,0.458007 -0.36459,0.305355 -0.54688,0.676774 -0.54687,1.114258 -1e-5,0.319025 0.15038,0.606134 0.45117,0.861328 0.29166,0.264337 0.98436,0.510431 2.07812,0.738282 2.70702,0.583346 4.64615,1.173514 5.81739,1.770507 1.1712,0.597017 2.02342,1.337576 2.55664,2.22168 0.53318,0.884123 0.79978,1.873055 0.7998,2.966797 -2e-5,1.285161 -0.35549,2.470056 -1.06641,3.554687 -0.71095,1.084638 -1.70444,1.907228 -2.98046,2.467774 -1.27606,0.560547 -2.88478,0.84082 -4.82618,0.84082 -3.40886,0 -5.76953,-0.656249 -7.08203,-1.96875 -1.3125,-1.312497 -2.05534,-2.980464 -2.22851,-5.003906 z" + inkscape:connector-curvature="0" /> + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" /> + d="m 778.62402,43.535286 5.89258,-0.369141 c 0.1276,0.957038 0.38736,1.686204 0.7793,2.1875 0.63801,0.811202 1.54947,1.216801 2.73437,1.216797 0.88411,4e-6 1.56542,-0.207353 2.04395,-0.62207 0.4785,-0.414709 0.71776,-0.895503 0.71777,-1.442383 -1e-5,-0.519525 -0.22788,-0.984368 -0.68359,-1.394531 -0.45574,-0.410149 -1.51303,-0.797518 -3.17188,-1.16211 -2.71615,-0.610668 -4.653,-1.421865 -5.81054,-2.433593 -1.16667,-1.011707 -1.75001,-2.30142 -1.75,-3.869141 -10e-6,-1.029932 0.2985,-2.002913 0.8955,-2.918945 0.59701,-0.915998 1.49479,-1.636049 2.69336,-2.160156 1.19856,-0.524069 2.84147,-0.786113 4.92871,-0.786133 2.56119,2e-5 4.51399,0.476257 5.8584,1.428711 1.34439,0.952492 2.14419,2.46779 2.39942,4.545898 l -5.83789,0.341797 c -0.15496,-0.902329 -0.48081,-1.558578 -0.97754,-1.96875 -0.49676,-0.41014 -1.18263,-0.615218 -2.05762,-0.615234 -0.72006,1.6e-5 -1.26238,0.152685 -1.62695,0.458007 -0.36459,0.305355 -0.54689,0.676774 -0.54688,1.114258 -1e-5,0.319025 0.15039,0.606134 0.45117,0.861328 0.29166,0.264337 0.98437,0.510431 2.07813,0.738282 2.70702,0.583346 4.64614,1.173514 5.81738,1.770507 1.17121,0.597017 2.02342,1.337576 2.55664,2.22168 0.53319,0.884123 0.79979,1.873055 0.79981,2.966797 -2e-5,1.285161 -0.35549,2.470056 -1.06641,3.554687 -0.71095,1.084638 -1.70444,1.907228 -2.98047,2.467774 -1.27605,0.560547 -2.88478,0.84082 -4.82617,0.84082 -3.40886,0 -5.76954,-0.656249 -7.08203,-1.96875 -1.3125,-1.312497 -2.05534,-2.980464 -2.22852,-5.003906 z" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + d="m 26.930511,30.123177 5.878907,0 2.11914,11.197265 3.089844,-11.197265 5.865234,0 3.103516,11.197265 2.119141,-11.197265 5.851562,0 -4.416015,20.042968 -6.070313,0 -3.513672,-12.61914 -3.5,12.61914 -6.070312,0 z" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + d="m 530.34277,30.123177 16.59766,0 0,4.279296 -10.39063,0 0,3.185547 9.63868,0 0,4.087891 -9.63868,0 0,3.951172 10.69141,0 0,4.539062 -16.89844,0 z" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3048" + inkscape:connector-curvature="0" /> + id="path3651" + inkscape:connector-curvature="0" /> + id="path3653" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3656" + inkscape:connector-curvature="0" /> + id="path3658" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3661" + inkscape:connector-curvature="0" /> + id="path3663" + inkscape:connector-curvature="0" /> + id="path3056" + inkscape:connector-curvature="0" /> + id="path3666" + inkscape:connector-curvature="0" /> + id="path3668" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3671" + inkscape:connector-curvature="0" /> + id="path3673" + inkscape:connector-curvature="0" /> + id="path3060" + inkscape:connector-curvature="0" /> + id="path3676" + inkscape:connector-curvature="0" /> + id="path3678" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3681" + inkscape:connector-curvature="0" /> + id="path3683" + inkscape:connector-curvature="0" /> + id="path3685" + inkscape:connector-curvature="0" /> + id="path3924" + inkscape:connector-curvature="0" /> + id="path3688" + inkscape:connector-curvature="0" /> + id="path3690" + inkscape:connector-curvature="0" /> + id="path3692" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3695" + inkscape:connector-curvature="0" /> + id="path3697" + inkscape:connector-curvature="0" /> + id="path3699" + inkscape:connector-curvature="0" /> + id="path3940" + inkscape:connector-curvature="0" /> + id="path3702" + inkscape:connector-curvature="0" /> + id="path3704" + inkscape:connector-curvature="0" /> + id="path3706" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3709" + inkscape:connector-curvature="0" /> + id="path3711" + inkscape:connector-curvature="0" /> + id="path3713" + inkscape:connector-curvature="0" /> + id="path3956" + inkscape:connector-curvature="0" /> + id="path3716" + inkscape:connector-curvature="0" /> + id="path3718" + inkscape:connector-curvature="0" /> + id="path3720" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3723" + inkscape:connector-curvature="0" /> + id="path3725" + inkscape:connector-curvature="0" /> + id="path3727" + inkscape:connector-curvature="0" /> + id="path3972" + inkscape:connector-curvature="0" /> + id="path3730" + inkscape:connector-curvature="0" /> + id="path3732" + inkscape:connector-curvature="0" /> + id="path3734" + inkscape:connector-curvature="0" /> + id="path4052" + inkscape:connector-curvature="0" /> + id="path3737" + inkscape:connector-curvature="0" /> + id="path3739" + inkscape:connector-curvature="0" /> + id="path3741" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3744" + inkscape:connector-curvature="0" /> + id="path3746" + inkscape:connector-curvature="0" /> + id="path3748" + inkscape:connector-curvature="0" /> + id="path4068" + inkscape:connector-curvature="0" /> + id="path3751" + inkscape:connector-curvature="0" /> + id="path3753" + inkscape:connector-curvature="0" /> + id="path3755" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3758" + inkscape:connector-curvature="0" /> + id="path3760" + inkscape:connector-curvature="0" /> + id="path3762" + inkscape:connector-curvature="0" /> + id="path4084" + inkscape:connector-curvature="0" /> + id="path3765" + inkscape:connector-curvature="0" /> + id="path3767" + inkscape:connector-curvature="0" /> + id="path3769" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3772" + inkscape:connector-curvature="0" /> + id="path3774" + inkscape:connector-curvature="0" /> + id="path3776" + inkscape:connector-curvature="0" /> + id="path4100" + inkscape:connector-curvature="0" /> + id="path3780" + inkscape:connector-curvature="0" /> + id="path3782" + inkscape:connector-curvature="0" /> + id="path3784" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3787" + inkscape:connector-curvature="0" /> + id="path3789" + inkscape:connector-curvature="0" /> + id="path3791" + inkscape:connector-curvature="0" /> + id="path4116" + inkscape:connector-curvature="0" /> + id="path3794" + inkscape:connector-curvature="0" /> + id="path3796" + inkscape:connector-curvature="0" /> + id="path3798" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3801" + inkscape:connector-curvature="0" /> + id="path3803" + inkscape:connector-curvature="0" /> + id="path3805" + inkscape:connector-curvature="0" /> + id="path4228" + inkscape:connector-curvature="0" /> + id="path3809" + inkscape:connector-curvature="0" /> + id="path3811" + inkscape:connector-curvature="0" /> + id="path3813" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3816" + inkscape:connector-curvature="0" /> + id="path3818" + inkscape:connector-curvature="0" /> + id="path3820" + inkscape:connector-curvature="0" /> + id="path4244" + inkscape:connector-curvature="0" /> + id="path3823" + inkscape:connector-curvature="0" /> + id="path3825" + inkscape:connector-curvature="0" /> + id="path3827" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3830" + inkscape:connector-curvature="0" /> + id="path3832" + inkscape:connector-curvature="0" /> + id="path3834" + inkscape:connector-curvature="0" /> + id="path4260" + inkscape:connector-curvature="0" /> + id="path3837" + inkscape:connector-curvature="0" /> + id="path3839" + inkscape:connector-curvature="0" /> + id="path3841" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3844" + inkscape:connector-curvature="0" /> + id="path3846" + inkscape:connector-curvature="0" /> + id="path3848" + inkscape:connector-curvature="0" /> + id="path3306" + inkscape:connector-curvature="0" /> + id="path3851" + inkscape:connector-curvature="0" /> + id="path3853" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3856" + inkscape:connector-curvature="0" /> + id="path3858" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" + inkscape:connector-curvature="0" /> + id="path4116-9" + inkscape:connector-curvature="0" /> + id="path3794-8" + inkscape:connector-curvature="0" /> + id="path3796-8" + inkscape:connector-curvature="0" /> + id="path3798-2" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3801-1" + inkscape:connector-curvature="0" /> + id="path3803-7" + inkscape:connector-curvature="0" /> + id="path3805-1" + inkscape:connector-curvature="0" /> + id="path4228-5" + inkscape:connector-curvature="0" /> + id="path3809-7" + inkscape:connector-curvature="0" /> + id="path3811-6" + inkscape:connector-curvature="0" /> + id="path3813-1" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3816-2" + inkscape:connector-curvature="0" /> + id="path3818-2" + inkscape:connector-curvature="0" /> + id="path3820-1" + inkscape:connector-curvature="0" /> + id="path4244-8" + inkscape:connector-curvature="0" /> + id="path3823-7" + inkscape:connector-curvature="0" /> + id="path3825-6" + inkscape:connector-curvature="0" /> + id="path3827-1" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3830-7" + inkscape:connector-curvature="0" /> + id="path3832-9" + inkscape:connector-curvature="0" /> + id="path3834-5" + inkscape:connector-curvature="0" /> + id="path4260-3" + inkscape:connector-curvature="0" /> + id="path3837-2" + inkscape:connector-curvature="0" /> + id="path3839-3" + inkscape:connector-curvature="0" /> + id="path3841-3" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3844-3" + inkscape:connector-curvature="0" /> + id="path3846-8" + inkscape:connector-curvature="0" /> + id="path3848-7" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3681-1" + inkscape:connector-curvature="0" /> + id="path3683-9" + inkscape:connector-curvature="0" /> + id="path3685-8" + inkscape:connector-curvature="0" /> + id="path3924-5" + inkscape:connector-curvature="0" /> + id="path3688-2" + inkscape:connector-curvature="0" /> + id="path3690-8" + inkscape:connector-curvature="0" /> + id="path3692-6" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3695-8" + inkscape:connector-curvature="0" /> + id="path3697-6" + inkscape:connector-curvature="0" /> + id="path3699-5" + inkscape:connector-curvature="0" /> + id="path3940-9" + inkscape:connector-curvature="0" /> + id="path3702-0" + inkscape:connector-curvature="0" /> + id="path3704-6" + inkscape:connector-curvature="0" /> + id="path3706-1" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3709-3" + inkscape:connector-curvature="0" /> + id="path3711-4" + inkscape:connector-curvature="0" /> + id="path3713-4" + inkscape:connector-curvature="0" /> + id="path3956-0" + inkscape:connector-curvature="0" /> + id="path3716-6" + inkscape:connector-curvature="0" /> + id="path3718-1" + inkscape:connector-curvature="0" /> + id="path3720-8" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3723-3" + inkscape:connector-curvature="0" /> + id="path3725-7" + inkscape:connector-curvature="0" /> + id="path3727-8" + inkscape:connector-curvature="0" /> + id="path3972-2" + inkscape:connector-curvature="0" /> + id="path3730-1" + inkscape:connector-curvature="0" /> + id="path3732-3" + inkscape:connector-curvature="0" /> + id="path3734-5" + inkscape:connector-curvature="0" /> @@ -3570,7 +4191,8 @@ inkscape:groupmode="layer" id="layer6" inkscape:label="Bottom area" - style="display:inline"> + style="display:none" + sodipodi:insensitive="true"> + id="path10183" + inkscape:connector-curvature="0" /> + id="path10185" + inkscape:connector-curvature="0" /> @@ -3630,19 +4254,22 @@ id="gcstelemetry-Connected" d="m -109.55949,412.40842 0,9.28125 -31.40625,0 0,4.90625 0,0.0937 0,4.90625 31.40625,0 0,9.28125 14.250003,-14.25 -14.250003,-14.21875 z" style="fill:#1c870b;fill-opacity:1;stroke:#113b05;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - inkscape:label="#path7548" /> + inkscape:label="#path7548" + inkscape:connector-curvature="0" /> + sodipodi:nodetypes="ccccccccccccccccc" + inkscape:connector-curvature="0" /> + sodipodi:nodetypes="cccccccccc" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#1c5313;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#1c5313;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + inkscape:connector-curvature="0" /> + id="path5044" + inkscape:connector-curvature="0" /> + id="path5046" + inkscape:connector-curvature="0" /> + id="path4035" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4039" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4043" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4061" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4065" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4071" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4075" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4079" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4085" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4089" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4095" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4099" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4103" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4109" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4113" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4119" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5650" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5654" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5658" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5662" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5666" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5670" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5674" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5678" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5682" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5686" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5690" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5694" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5698" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5702" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5706" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> @@ -4020,6 +4713,7 @@ style="fill:#453e3e;fill-opacity:1;stroke:#000000;stroke-width:4.08031273;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" d="m -115.54603,-47.690059 c -2.50791,0 -4.54785,1.99743 -4.54785,4.50534 l 0,807.009359 c 0,2.5079 2.03994,4.54785 4.54785,4.54785 l 807.00936,0 c 2.5079,0 4.50534,-2.03995 4.50534,-4.54785 l 0,-807.009359 c 0,-2.50791 -1.99744,-4.50534 -4.50534,-4.50534 l -807.00936,0 z M 289.34,11.395534 c 150.15374,0 271.88009,59.618647 272.02085,133.162706 l 0.21252,48.57516 -0.38253,374.99409 C 556.30557,639.62843 436.47945,673.69951 289.34,673.69951 c -147.13944,0 -266.965544,-34.07108 -271.850832,-105.57202 l -0.212516,0 0,-374.99409 0.0425,-48.58122 C 17.459912,71.008115 139.18627,11.395534 289.34,11.395534 z" id="rect2816" - sodipodi:nodetypes="cccccccccccccsccccc" /> + sodipodi:nodetypes="cccccccccccccsccccc" + inkscape:connector-curvature="0" /> diff --git a/flight/CopterControl/System/inc/pios_config.h b/flight/CopterControl/System/inc/pios_config.h index 98c900387..392771a26 100644 --- a/flight/CopterControl/System/inc/pios_config.h +++ b/flight/CopterControl/System/inc/pios_config.h @@ -85,8 +85,8 @@ #define AUXUART_BAUDRATE 19200 /* Alarm Thresholds */ -#define HEAP_LIMIT_WARNING 350 -#define HEAP_LIMIT_CRITICAL 250 +#define HEAP_LIMIT_WARNING 220 +#define HEAP_LIMIT_CRITICAL 150 #define CPULOAD_LIMIT_WARNING 80 #define CPULOAD_LIMIT_CRITICAL 95 diff --git a/flight/Modules/Actuator/actuator.c b/flight/Modules/Actuator/actuator.c index 9d21dba5a..af8ee06ea 100644 --- a/flight/Modules/Actuator/actuator.c +++ b/flight/Modules/Actuator/actuator.c @@ -219,6 +219,9 @@ static void actuatorTask(void* parameters) case MIXERSETTINGS_CURVE2SOURCE_ACCESSORY0: case MIXERSETTINGS_CURVE2SOURCE_ACCESSORY1: case MIXERSETTINGS_CURVE2SOURCE_ACCESSORY2: + case MIXERSETTINGS_CURVE2SOURCE_ACCESSORY3: + case MIXERSETTINGS_CURVE2SOURCE_ACCESSORY4: + case MIXERSETTINGS_CURVE2SOURCE_ACCESSORY5: if(AccessoryDesiredInstGet(mixerSettings.Curve2Source - MIXERSETTINGS_CURVE2SOURCE_ACCESSORY0,&accessory) == 0) curve2 = MixerCurve(accessory.AccessoryVal,mixerSettings.ThrottleCurve2); else @@ -254,11 +257,16 @@ static void actuatorTask(void* parameters) status[ct] = 0; } - // If an accessory channel is selected + // If an accessory channel is selected for direct bypass mode + // In this configuration the accessory channel is scaled and mapped + // directly to output. Note: THERE IS NO SAFETY CHECK HERE FOR ARMING + // these also will not be updated in failsafe mode. I'm not sure what + // the correct behavior is since it seems domain specific. I don't love + // this code if( (mixers[ct].type >= MIXERSETTINGS_MIXER1TYPE_ACCESSORY0) && (mixers[ct].type <= MIXERSETTINGS_MIXER1TYPE_ACCESSORY2)) { - if(AccessoryDesiredInstGet(mixerSettings.Curve2Source - MIXERSETTINGS_CURVE2SOURCE_ACCESSORY0,&accessory) == 0) + if(AccessoryDesiredInstGet(mixers[ct].type - MIXERSETTINGS_MIXER1TYPE_ACCESSORY0,&accessory) == 0) status[ct] = accessory.AccessoryVal; else status[ct] = -1; diff --git a/flight/OpenPilot/Makefile.posix b/flight/OpenPilot/Makefile.posix index 2eff6f933..050323721 100644 --- a/flight/OpenPilot/Makefile.posix +++ b/flight/OpenPilot/Makefile.posix @@ -162,6 +162,7 @@ CFLAGS_UAVOBJECTS = $(UAVOBJDEFINE) endif ## PIOS Hardware (posix) +SRC += $(PIOSPOSIX)/pios_crc.c SRC += $(PIOSPOSIX)/pios_sys.c SRC += $(PIOSPOSIX)/pios_led.c SRC += $(PIOSPOSIX)/pios_delay.c diff --git a/flight/PiOS.posix/inc/pios_crc.h b/flight/PiOS.posix/inc/pios_crc.h new file mode 100644 index 000000000..3a64f8bab --- /dev/null +++ b/flight/PiOS.posix/inc/pios_crc.h @@ -0,0 +1,31 @@ +/** + ****************************************************************************** + * @addtogroup PIOS PIOS Core hardware abstraction layer + * @{ + * @addtogroup PIOS_CRC CRC Functions + * @{ + * + * @file pios_crc.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief CRC functions 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 + */ + +uint8_t PIOS_CRC_updateByte(uint8_t crc, const uint8_t data); +uint8_t PIOS_CRC_updateCRC(uint8_t crc, const uint8_t* data, int32_t length); diff --git a/flight/PiOS.posix/pios.h b/flight/PiOS.posix/pios.h index 4f6266aca..a82d13b81 100644 --- a/flight/PiOS.posix/pios.h +++ b/flight/PiOS.posix/pios.h @@ -64,6 +64,7 @@ #include #include #include +#include #define NELEMENTS(x) (sizeof(x) / sizeof(*(x))) diff --git a/flight/PiOS.posix/posix/pios_crc.c b/flight/PiOS.posix/posix/pios_crc.c new file mode 100644 index 000000000..548ba2648 --- /dev/null +++ b/flight/PiOS.posix/posix/pios_crc.c @@ -0,0 +1,74 @@ +/* + * pios_crc.c + * OpenPilotOSX + * + * Created by James Cotton on 6/4/11. + * Copyright 2011 OpenPilot. All rights reserved. + * + */ + +#include "pios.h" + +// CRC lookup table +static const uint8_t crc_table[256] = { + 0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15, 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d, + 0x70, 0x77, 0x7e, 0x79, 0x6c, 0x6b, 0x62, 0x65, 0x48, 0x4f, 0x46, 0x41, 0x54, 0x53, 0x5a, 0x5d, + 0xe0, 0xe7, 0xee, 0xe9, 0xfc, 0xfb, 0xf2, 0xf5, 0xd8, 0xdf, 0xd6, 0xd1, 0xc4, 0xc3, 0xca, 0xcd, + 0x90, 0x97, 0x9e, 0x99, 0x8c, 0x8b, 0x82, 0x85, 0xa8, 0xaf, 0xa6, 0xa1, 0xb4, 0xb3, 0xba, 0xbd, + 0xc7, 0xc0, 0xc9, 0xce, 0xdb, 0xdc, 0xd5, 0xd2, 0xff, 0xf8, 0xf1, 0xf6, 0xe3, 0xe4, 0xed, 0xea, + 0xb7, 0xb0, 0xb9, 0xbe, 0xab, 0xac, 0xa5, 0xa2, 0x8f, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9d, 0x9a, + 0x27, 0x20, 0x29, 0x2e, 0x3b, 0x3c, 0x35, 0x32, 0x1f, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0d, 0x0a, + 0x57, 0x50, 0x59, 0x5e, 0x4b, 0x4c, 0x45, 0x42, 0x6f, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7d, 0x7a, + 0x89, 0x8e, 0x87, 0x80, 0x95, 0x92, 0x9b, 0x9c, 0xb1, 0xb6, 0xbf, 0xb8, 0xad, 0xaa, 0xa3, 0xa4, + 0xf9, 0xfe, 0xf7, 0xf0, 0xe5, 0xe2, 0xeb, 0xec, 0xc1, 0xc6, 0xcf, 0xc8, 0xdd, 0xda, 0xd3, 0xd4, + 0x69, 0x6e, 0x67, 0x60, 0x75, 0x72, 0x7b, 0x7c, 0x51, 0x56, 0x5f, 0x58, 0x4d, 0x4a, 0x43, 0x44, + 0x19, 0x1e, 0x17, 0x10, 0x05, 0x02, 0x0b, 0x0c, 0x21, 0x26, 0x2f, 0x28, 0x3d, 0x3a, 0x33, 0x34, + 0x4e, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5c, 0x5b, 0x76, 0x71, 0x78, 0x7f, 0x6a, 0x6d, 0x64, 0x63, + 0x3e, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2c, 0x2b, 0x06, 0x01, 0x08, 0x0f, 0x1a, 0x1d, 0x14, 0x13, + 0xae, 0xa9, 0xa0, 0xa7, 0xb2, 0xb5, 0xbc, 0xbb, 0x96, 0x91, 0x98, 0x9f, 0x8a, 0x8d, 0x84, 0x83, + 0xde, 0xd9, 0xd0, 0xd7, 0xc2, 0xc5, 0xcc, 0xcb, 0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3 +}; + +/** + * Update the crc value with new data. + * + * Generated by pycrc v0.7.5, http://www.tty1.net/pycrc/ + * using the configuration: + * Width = 8 + * Poly = 0x07 + * XorIn = 0x00 + * ReflectIn = False + * XorOut = 0x00 + * ReflectOut = False + * Algorithm = table-driven + * + * \param crc The current crc value. + * \param data Pointer to a buffer of \a data_len bytes. + * \param length Number of bytes in the \a data buffer. + * \return The updated crc value. + */ +uint8_t PIOS_CRC_updateByte(uint8_t crc, const uint8_t data) +{ + return crc_table[crc ^ data]; +} + +/* + * @brief Update a CRC with a data buffer + * @param[in] crc Starting CRC value + * @param[in] data Data buffer + * @param[in] length Number of bytes to process + * @returns Updated CRC + */ +uint8_t PIOS_CRC_updateCRC(uint8_t crc, const uint8_t* data, int32_t length) +{ + // use registers for speed + register int32_t len = length; + register uint8_t crc8 = crc; + register const uint8_t *p = data; + + while (len--) + crc8 = crc_table[crc8 ^ *p++]; + + return crc8; +} + diff --git a/ground/openpilotgcs/share/openpilotgcs/dials/default/flightmode-status.svg b/ground/openpilotgcs/share/openpilotgcs/dials/default/flightmode-status.svg index dca4d213a..80935d0c3 100644 --- a/ground/openpilotgcs/share/openpilotgcs/dials/default/flightmode-status.svg +++ b/ground/openpilotgcs/share/openpilotgcs/dials/default/flightmode-status.svg @@ -14,7 +14,7 @@ height="80.827866" id="svg10068" version="1.1" - inkscape:version="0.47 r22583" + inkscape:version="0.48.1 r9760" sodipodi:docname="flightmode-status.svg" inkscape:export-filename="H:\Documents\Hobbies\W433\My Gauges\vbat-001.png" inkscape:export-xdpi="103.61" @@ -949,6 +949,94 @@ fx="29.77438" fy="7.0922189" r="25.380436" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ground/openpilotgcs/share/openpilotgcs/pfd/default/pfd.svg b/ground/openpilotgcs/share/openpilotgcs/pfd/default/pfd.svg index a5daa9575..6313bf1df 100755 --- a/ground/openpilotgcs/share/openpilotgcs/pfd/default/pfd.svg +++ b/ground/openpilotgcs/share/openpilotgcs/pfd/default/pfd.svg @@ -14,7 +14,7 @@ height="707.56323" id="svg2" version="1.1" - inkscape:version="0.47 r22583" + inkscape:version="0.48.1 " sodipodi:docname="pfd.svg" style="display:inline" inkscape:export-filename="H:\Documents\Hobbies\OpenPilot\SVN\artwork\PFD-2.png" @@ -1561,6 +1561,52 @@ inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 0.5 : 1" sodipodi:type="inkscape:persp3d" /> + + + + + + + - - - - - - - - - - - - - - 20 - 20 - - - - 10 - 10 - - - - 10 - 10 - - - - 20 - 20 - + transform="matrix(4.6362185,0,0,1.5267412,-1475.4746,-169.05952)" + id="g4280"> + + + + 10 + 10 + + + + + 20 + 20 + + + + + -10 + -10 + + + + + + + + + + + + + + + + + + + -20 + -20 + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2094,141 +2075,585 @@ id="tspan4328" sodipodi:role="line">GPS - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + inkscape:label="#g5089"> + id="angle-3"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + id="g7953"> + + + + + + + + + + + + + + + + + + + + inkscape:label="#path3779-1" + inkscape:connector-curvature="0" /> + inkscape:label="#path3779-7" + inkscape:connector-curvature="0" /> - - - - + inkscape:label="#g4577"> + + + style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:3.06858087;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" + inkscape:connector-curvature="0" /> + d="m 280.28409,30.123177 5.7832,0 7.54688,11.08789 0,-11.08789 5.83789,0 0,20.042968 -5.83789,0 -7.50586,-11.005859 0,11.005859 -5.82422,0 z" + inkscape:connector-curvature="0" /> + id="path6986" + inkscape:connector-curvature="0" /> + d="m -217.0715,43.535286 5.89258,-0.369141 c 0.12759,0.957038 0.38736,1.686204 0.77929,2.1875 0.63801,0.811202 1.54947,1.216801 2.73438,1.216797 0.8841,4e-6 1.56542,-0.207353 2.04394,-0.62207 0.47851,-0.414709 0.71776,-0.895503 0.71778,-1.442383 -2e-5,-0.519525 -0.22788,-0.984368 -0.6836,-1.394531 -0.45574,-0.410149 -1.51303,-0.797518 -3.17187,-1.16211 -2.71616,-0.610668 -4.653,-1.421865 -5.81055,-2.433593 -1.16667,-1.011707 -1.75,-2.30142 -1.75,-3.869141 0,-1.029932 0.2985,-2.002913 0.89551,-2.918945 0.597,-0.915998 1.49479,-1.636049 2.69336,-2.160156 1.19856,-0.524069 2.84146,-0.786113 4.92871,-0.786133 2.56118,2e-5 4.51398,0.476257 5.8584,1.428711 1.34438,0.952492 2.14418,2.46779 2.39941,4.545898 l -5.83789,0.341797 c -0.15496,-0.902329 -0.48081,-1.558578 -0.97754,-1.96875 -0.49675,-0.41014 -1.18263,-0.615218 -2.05762,-0.615234 -0.72006,1.6e-5 -1.26237,0.152685 -1.62695,0.458007 -0.36459,0.305355 -0.54688,0.676774 -0.54687,1.114258 -1e-5,0.319025 0.15038,0.606134 0.45117,0.861328 0.29166,0.264337 0.98436,0.510431 2.07812,0.738282 2.70702,0.583346 4.64615,1.173514 5.81739,1.770507 1.1712,0.597017 2.02342,1.337576 2.55664,2.22168 0.53318,0.884123 0.79978,1.873055 0.7998,2.966797 -2e-5,1.285161 -0.35549,2.470056 -1.06641,3.554687 -0.71095,1.084638 -1.70444,1.907228 -2.98046,2.467774 -1.27606,0.560547 -2.88478,0.84082 -4.82618,0.84082 -3.40886,0 -5.76953,-0.656249 -7.08203,-1.96875 -1.3125,-1.312497 -2.05534,-2.980464 -2.22851,-5.003906 z" + inkscape:connector-curvature="0" /> + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" /> + d="m 778.62402,43.535286 5.89258,-0.369141 c 0.1276,0.957038 0.38736,1.686204 0.7793,2.1875 0.63801,0.811202 1.54947,1.216801 2.73437,1.216797 0.88411,4e-6 1.56542,-0.207353 2.04395,-0.62207 0.4785,-0.414709 0.71776,-0.895503 0.71777,-1.442383 -1e-5,-0.519525 -0.22788,-0.984368 -0.68359,-1.394531 -0.45574,-0.410149 -1.51303,-0.797518 -3.17188,-1.16211 -2.71615,-0.610668 -4.653,-1.421865 -5.81054,-2.433593 -1.16667,-1.011707 -1.75001,-2.30142 -1.75,-3.869141 -10e-6,-1.029932 0.2985,-2.002913 0.8955,-2.918945 0.59701,-0.915998 1.49479,-1.636049 2.69336,-2.160156 1.19856,-0.524069 2.84147,-0.786113 4.92871,-0.786133 2.56119,2e-5 4.51399,0.476257 5.8584,1.428711 1.34439,0.952492 2.14419,2.46779 2.39942,4.545898 l -5.83789,0.341797 c -0.15496,-0.902329 -0.48081,-1.558578 -0.97754,-1.96875 -0.49676,-0.41014 -1.18263,-0.615218 -2.05762,-0.615234 -0.72006,1.6e-5 -1.26238,0.152685 -1.62695,0.458007 -0.36459,0.305355 -0.54689,0.676774 -0.54688,1.114258 -1e-5,0.319025 0.15039,0.606134 0.45117,0.861328 0.29166,0.264337 0.98437,0.510431 2.07813,0.738282 2.70702,0.583346 4.64614,1.173514 5.81738,1.770507 1.17121,0.597017 2.02342,1.337576 2.55664,2.22168 0.53319,0.884123 0.79979,1.873055 0.79981,2.966797 -2e-5,1.285161 -0.35549,2.470056 -1.06641,3.554687 -0.71095,1.084638 -1.70444,1.907228 -2.98047,2.467774 -1.27605,0.560547 -2.88478,0.84082 -4.82617,0.84082 -3.40886,0 -5.76954,-0.656249 -7.08203,-1.96875 -1.3125,-1.312497 -2.05534,-2.980464 -2.22852,-5.003906 z" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + d="m 26.930511,30.123177 5.878907,0 2.11914,11.197265 3.089844,-11.197265 5.865234,0 3.103516,11.197265 2.119141,-11.197265 5.851562,0 -4.416015,20.042968 -6.070313,0 -3.513672,-12.61914 -3.5,12.61914 -6.070312,0 z" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + d="m 530.34277,30.123177 16.59766,0 0,4.279296 -10.39063,0 0,3.185547 9.63868,0 0,4.087891 -9.63868,0 0,3.951172 10.69141,0 0,4.539062 -16.89844,0 z" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3048" + inkscape:connector-curvature="0" /> + id="path3651" + inkscape:connector-curvature="0" /> + id="path3653" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3656" + inkscape:connector-curvature="0" /> + id="path3658" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3661" + inkscape:connector-curvature="0" /> + id="path3663" + inkscape:connector-curvature="0" /> + id="path3056" + inkscape:connector-curvature="0" /> + id="path3666" + inkscape:connector-curvature="0" /> + id="path3668" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3671" + inkscape:connector-curvature="0" /> + id="path3673" + inkscape:connector-curvature="0" /> + id="path3060" + inkscape:connector-curvature="0" /> + id="path3676" + inkscape:connector-curvature="0" /> + id="path3678" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3681" + inkscape:connector-curvature="0" /> + id="path3683" + inkscape:connector-curvature="0" /> + id="path3685" + inkscape:connector-curvature="0" /> + id="path3924" + inkscape:connector-curvature="0" /> + id="path3688" + inkscape:connector-curvature="0" /> + id="path3690" + inkscape:connector-curvature="0" /> + id="path3692" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3695" + inkscape:connector-curvature="0" /> + id="path3697" + inkscape:connector-curvature="0" /> + id="path3699" + inkscape:connector-curvature="0" /> + id="path3940" + inkscape:connector-curvature="0" /> + id="path3702" + inkscape:connector-curvature="0" /> + id="path3704" + inkscape:connector-curvature="0" /> + id="path3706" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3709" + inkscape:connector-curvature="0" /> + id="path3711" + inkscape:connector-curvature="0" /> + id="path3713" + inkscape:connector-curvature="0" /> + id="path3956" + inkscape:connector-curvature="0" /> + id="path3716" + inkscape:connector-curvature="0" /> + id="path3718" + inkscape:connector-curvature="0" /> + id="path3720" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3723" + inkscape:connector-curvature="0" /> + id="path3725" + inkscape:connector-curvature="0" /> + id="path3727" + inkscape:connector-curvature="0" /> + id="path3972" + inkscape:connector-curvature="0" /> + id="path3730" + inkscape:connector-curvature="0" /> + id="path3732" + inkscape:connector-curvature="0" /> + id="path3734" + inkscape:connector-curvature="0" /> + id="path4052" + inkscape:connector-curvature="0" /> + id="path3737" + inkscape:connector-curvature="0" /> + id="path3739" + inkscape:connector-curvature="0" /> + id="path3741" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3744" + inkscape:connector-curvature="0" /> + id="path3746" + inkscape:connector-curvature="0" /> + id="path3748" + inkscape:connector-curvature="0" /> + id="path4068" + inkscape:connector-curvature="0" /> + id="path3751" + inkscape:connector-curvature="0" /> + id="path3753" + inkscape:connector-curvature="0" /> + id="path3755" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3758" + inkscape:connector-curvature="0" /> + id="path3760" + inkscape:connector-curvature="0" /> + id="path3762" + inkscape:connector-curvature="0" /> + id="path4084" + inkscape:connector-curvature="0" /> + id="path3765" + inkscape:connector-curvature="0" /> + id="path3767" + inkscape:connector-curvature="0" /> + id="path3769" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3772" + inkscape:connector-curvature="0" /> + id="path3774" + inkscape:connector-curvature="0" /> + id="path3776" + inkscape:connector-curvature="0" /> + id="path4100" + inkscape:connector-curvature="0" /> + id="path3780" + inkscape:connector-curvature="0" /> + id="path3782" + inkscape:connector-curvature="0" /> + id="path3784" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3787" + inkscape:connector-curvature="0" /> + id="path3789" + inkscape:connector-curvature="0" /> + id="path3791" + inkscape:connector-curvature="0" /> + id="path4116" + inkscape:connector-curvature="0" /> + id="path3794" + inkscape:connector-curvature="0" /> + id="path3796" + inkscape:connector-curvature="0" /> + id="path3798" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3801" + inkscape:connector-curvature="0" /> + id="path3803" + inkscape:connector-curvature="0" /> + id="path3805" + inkscape:connector-curvature="0" /> + id="path4228" + inkscape:connector-curvature="0" /> + id="path3809" + inkscape:connector-curvature="0" /> + id="path3811" + inkscape:connector-curvature="0" /> + id="path3813" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3816" + inkscape:connector-curvature="0" /> + id="path3818" + inkscape:connector-curvature="0" /> + id="path3820" + inkscape:connector-curvature="0" /> + id="path4244" + inkscape:connector-curvature="0" /> + id="path3823" + inkscape:connector-curvature="0" /> + id="path3825" + inkscape:connector-curvature="0" /> + id="path3827" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3830" + inkscape:connector-curvature="0" /> + id="path3832" + inkscape:connector-curvature="0" /> + id="path3834" + inkscape:connector-curvature="0" /> + id="path4260" + inkscape:connector-curvature="0" /> + id="path3837" + inkscape:connector-curvature="0" /> + id="path3839" + inkscape:connector-curvature="0" /> + id="path3841" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3844" + inkscape:connector-curvature="0" /> + id="path3846" + inkscape:connector-curvature="0" /> + id="path3848" + inkscape:connector-curvature="0" /> + id="path3306" + inkscape:connector-curvature="0" /> + id="path3851" + inkscape:connector-curvature="0" /> + id="path3853" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3856" + inkscape:connector-curvature="0" /> + id="path3858" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" + inkscape:connector-curvature="0" /> + id="path4116-9" + inkscape:connector-curvature="0" /> + id="path3794-8" + inkscape:connector-curvature="0" /> + id="path3796-8" + inkscape:connector-curvature="0" /> + id="path3798-2" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3801-1" + inkscape:connector-curvature="0" /> + id="path3803-7" + inkscape:connector-curvature="0" /> + id="path3805-1" + inkscape:connector-curvature="0" /> + id="path4228-5" + inkscape:connector-curvature="0" /> + id="path3809-7" + inkscape:connector-curvature="0" /> + id="path3811-6" + inkscape:connector-curvature="0" /> + id="path3813-1" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3816-2" + inkscape:connector-curvature="0" /> + id="path3818-2" + inkscape:connector-curvature="0" /> + id="path3820-1" + inkscape:connector-curvature="0" /> + id="path4244-8" + inkscape:connector-curvature="0" /> + id="path3823-7" + inkscape:connector-curvature="0" /> + id="path3825-6" + inkscape:connector-curvature="0" /> + id="path3827-1" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3830-7" + inkscape:connector-curvature="0" /> + id="path3832-9" + inkscape:connector-curvature="0" /> + id="path3834-5" + inkscape:connector-curvature="0" /> + id="path4260-3" + inkscape:connector-curvature="0" /> + id="path3837-2" + inkscape:connector-curvature="0" /> + id="path3839-3" + inkscape:connector-curvature="0" /> + id="path3841-3" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3844-3" + inkscape:connector-curvature="0" /> + id="path3846-8" + inkscape:connector-curvature="0" /> + id="path3848-7" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3681-1" + inkscape:connector-curvature="0" /> + id="path3683-9" + inkscape:connector-curvature="0" /> + id="path3685-8" + inkscape:connector-curvature="0" /> + id="path3924-5" + inkscape:connector-curvature="0" /> + id="path3688-2" + inkscape:connector-curvature="0" /> + id="path3690-8" + inkscape:connector-curvature="0" /> + id="path3692-6" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3695-8" + inkscape:connector-curvature="0" /> + id="path3697-6" + inkscape:connector-curvature="0" /> + id="path3699-5" + inkscape:connector-curvature="0" /> + id="path3940-9" + inkscape:connector-curvature="0" /> + id="path3702-0" + inkscape:connector-curvature="0" /> + id="path3704-6" + inkscape:connector-curvature="0" /> + id="path3706-1" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3709-3" + inkscape:connector-curvature="0" /> + id="path3711-4" + inkscape:connector-curvature="0" /> + id="path3713-4" + inkscape:connector-curvature="0" /> + id="path3956-0" + inkscape:connector-curvature="0" /> + id="path3716-6" + inkscape:connector-curvature="0" /> + id="path3718-1" + inkscape:connector-curvature="0" /> + id="path3720-8" + inkscape:connector-curvature="0" /> + style="fill:#ffffff;fill-opacity:1;stroke:#fff8f8;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path3723-3" + inkscape:connector-curvature="0" /> + id="path3725-7" + inkscape:connector-curvature="0" /> + id="path3727-8" + inkscape:connector-curvature="0" /> + id="path3972-2" + inkscape:connector-curvature="0" /> + id="path3730-1" + inkscape:connector-curvature="0" /> + id="path3732-3" + inkscape:connector-curvature="0" /> + id="path3734-5" + inkscape:connector-curvature="0" /> @@ -3570,7 +4191,8 @@ inkscape:groupmode="layer" id="layer6" inkscape:label="Bottom area" - style="display:inline"> + style="display:none" + sodipodi:insensitive="true"> + id="path10183" + inkscape:connector-curvature="0" /> + id="path10185" + inkscape:connector-curvature="0" /> @@ -3630,19 +4254,22 @@ id="gcstelemetry-Connected" d="m -109.55949,412.40842 0,9.28125 -31.40625,0 0,4.90625 0,0.0937 0,4.90625 31.40625,0 0,9.28125 14.250003,-14.25 -14.250003,-14.21875 z" style="fill:#1c870b;fill-opacity:1;stroke:#113b05;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - inkscape:label="#path7548" /> + inkscape:label="#path7548" + inkscape:connector-curvature="0" /> + sodipodi:nodetypes="ccccccccccccccccc" + inkscape:connector-curvature="0" /> + sodipodi:nodetypes="cccccccccc" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#1c5313;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#1c5313;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + inkscape:connector-curvature="0" /> + id="path5044" + inkscape:connector-curvature="0" /> + id="path5046" + inkscape:connector-curvature="0" /> + id="path4035" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4039" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4043" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4061" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4065" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4071" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4075" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4079" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4085" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4089" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4095" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4099" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4103" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4109" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4113" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path4119" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5650" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5654" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5658" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5662" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5666" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5670" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5674" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5678" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5682" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5686" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5690" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5694" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5698" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5702" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:2.10024118;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> + id="path5706" + inkscape:connector-curvature="0" /> + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> @@ -4020,6 +4713,7 @@ style="fill:#453e3e;fill-opacity:1;stroke:#000000;stroke-width:4.08031273;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" d="m -115.54603,-47.690059 c -2.50791,0 -4.54785,1.99743 -4.54785,4.50534 l 0,807.009359 c 0,2.5079 2.03994,4.54785 4.54785,4.54785 l 807.00936,0 c 2.5079,0 4.50534,-2.03995 4.50534,-4.54785 l 0,-807.009359 c 0,-2.50791 -1.99744,-4.50534 -4.50534,-4.50534 l -807.00936,0 z M 289.34,11.395534 c 150.15374,0 271.88009,59.618647 272.02085,133.162706 l 0.21252,48.57516 -0.38253,374.99409 C 556.30557,639.62843 436.47945,673.69951 289.34,673.69951 c -147.13944,0 -266.965544,-34.07108 -271.850832,-105.57202 l -0.212516,0 0,-374.99409 0.0425,-48.58122 C 17.459912,71.008115 139.18627,11.395534 289.34,11.395534 z" id="rect2816" - sodipodi:nodetypes="cccccccccccccsccccc" /> + sodipodi:nodetypes="cccccccccccccsccccc" + inkscape:connector-curvature="0" /> diff --git a/ground/openpilotgcs/src/plugins/config/ahrs.ui b/ground/openpilotgcs/src/plugins/config/ahrs.ui index de39ad079..e41c73afd 100644 --- a/ground/openpilotgcs/src/plugins/config/ahrs.ui +++ b/ground/openpilotgcs/src/plugins/config/ahrs.ui @@ -673,16 +673,6 @@ new home location unless it is in indoor mode. - - - - Refresh this screen with current values from the board. - - - Request - - - diff --git a/ground/openpilotgcs/src/plugins/config/airframe.ui b/ground/openpilotgcs/src/plugins/config/airframe.ui index 50403ab93..66a99e902 100644 --- a/ground/openpilotgcs/src/plugins/config/airframe.ui +++ b/ground/openpilotgcs/src/plugins/config/airframe.ui @@ -1962,16 +1962,6 @@ p, li { white-space: pre-wrap; } - - - - Retrieve settings from OpenPilot - - - Get Current - - - @@ -2316,16 +2306,6 @@ p, li { white-space: pre-wrap; } - - - - Request current settings from the board. - - - Get Current - - - diff --git a/ground/openpilotgcs/src/plugins/config/ccattitude.ui b/ground/openpilotgcs/src/plugins/config/ccattitude.ui index 2497983f5..f4ee69629 100644 --- a/ground/openpilotgcs/src/plugins/config/ccattitude.ui +++ b/ground/openpilotgcs/src/plugins/config/ccattitude.ui @@ -325,13 +325,6 @@ arming it in that case! - - - - Get Current - - - diff --git a/ground/openpilotgcs/src/plugins/config/configahrswidget.cpp b/ground/openpilotgcs/src/plugins/config/configahrswidget.cpp index 9d81392e4..75cb57f78 100644 --- a/ground/openpilotgcs/src/plugins/config/configahrswidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configahrswidget.cpp @@ -216,18 +216,25 @@ ConfigAHRSWidget::ConfigAHRSWidget(QWidget *parent) : ConfigTaskWidget(parent) // Connect the signals connect(m_ahrs->ahrsCalibStart, SIGNAL(clicked()), this, SLOT(launchAHRSCalibration())); connect(m_ahrs->accelBiasStart, SIGNAL(clicked()), this, SLOT(launchAccelBiasCalibration())); - connect(m_ahrs->ahrsSettingsRequest, SIGNAL(clicked()), this, SLOT(ahrsSettingsRequest())); - /* - connect(m_ahrs->algorithm, SIGNAL(currentIndexChanged(int)), this, SLOT(ahrsSettingsSave())); - connect(m_ahrs->indoorFlight, SIGNAL(stateChanged(int)), this, SLOT(homeLocationSave())); - connect(m_ahrs->homeLocation, SIGNAL(clicked()), this, SLOT(homeLocationSaveSD())); - */ + + obj = dynamic_cast(getObjectManager()->getObject(QString("AHRSSettings"))); + connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshValues())); + obj = getObjectManager()->getObject(QString("HomeLocation")); + connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshValues())); + connect(m_ahrs->ahrsSettingsSaveRAM, SIGNAL(clicked()), this, SLOT(ahrsSettingsSaveRAM())); connect(m_ahrs->ahrsSettingsSaveSD, SIGNAL(clicked()), this, SLOT(ahrsSettingsSaveSD())); connect(m_ahrs->sixPointsStart, SIGNAL(clicked()), this, SLOT(multiPointCalibrationMode())); connect(m_ahrs->sixPointsSave, SIGNAL(clicked()), this, SLOT(savePositionData())); connect(m_ahrs->startDriftCalib, SIGNAL(clicked()),this, SLOT(launchGyroDriftCalibration())); - connect(parent, SIGNAL(autopilotConnected()),this, SLOT(ahrsSettingsRequest())); + + // Order is important: 1st request the settings (it will also enable the controls) + // then explicitely disable them. They will be re-enabled right afterwards by the + // configgadgetwidget if the autopilot is actually connected. + refreshValues(); + // when the AHRS Widget is instanciated, the autopilot is always connected // enableControls(false); + connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect())); + connect(parent, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect())); // Connect the help button connect(m_ahrs->ahrsHelp, SIGNAL(clicked()), this, SLOT(openHelp())); @@ -256,6 +263,13 @@ void ConfigAHRSWidget::resizeEvent(QResizeEvent *event) m_ahrs->sixPointsHelp->fitInView(paperplane,Qt::KeepAspectRatio); } + +void ConfigAHRSWidget::enableControls(bool enable) +{ + //m_ahrs->ahrsSettingsSaveRAM->setEnabled(enable); + m_ahrs->ahrsSettingsSaveSD->setEnabled(enable); +} + /** Starts an accelerometer bias calibration. */ @@ -274,7 +288,7 @@ void ConfigAHRSWidget::launchAccelBiasCalibration() accel_accum_y.clear(); accel_accum_z.clear(); - UAVDataObject* ahrsCalib = dynamic_cast(getObjectManager()->getObject(QString("AHRSCalibration"))); +// UAVDataObject* ahrsCalib = dynamic_cast(getObjectManager()->getObject(QString("AHRSCalibration"))); // ahrsCalib->getField("accel_bias")->setDouble(0,0); // ahrsCalib->getField("accel_bias")->setDouble(0,1); // ahrsCalib->getField("accel_bias")->setDouble(0,2); @@ -409,6 +423,7 @@ void ConfigAHRSWidget::launchGyroDriftCalibration() */ void ConfigAHRSWidget::driftCalibrationAttitudeRawUpdated(UAVObject* obj) { + Q_UNUSED(obj) // This is necessary to prevent a race condition on disconnect signal and another update if (collectingData == true) { /** @@ -568,8 +583,7 @@ void ConfigAHRSWidget::saveAHRSCalibration() UAVObjectField *field = obj->getField(QString("measure_var")); field->setValue("SET"); obj->updated(); - updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj); - + saveObjectToSD(obj); } FORCE_ALIGN_FUNC @@ -1136,17 +1150,16 @@ void ConfigAHRSWidget::drawVariancesGraph() /** Request current settings from the AHRS */ -void ConfigAHRSWidget::ahrsSettingsRequest() +void ConfigAHRSWidget::refreshValues() { - UAVObject *obj = dynamic_cast(getObjectManager()->getObject(QString("AHRSSettings"))); - obj->requestUpdate(); + UAVObject *obj = getObjectManager()->getObject(QString("AHRSSettings")); UAVObjectField *field = obj->getField(QString("Algorithm")); if (field) m_ahrs->algorithm->setCurrentIndex(m_ahrs->algorithm->findText(field->getValue().toString())); drawVariancesGraph(); - obj = dynamic_cast(getObjectManager()->getObject(QString("HomeLocation"))); + obj = getObjectManager()->getObject(QString("HomeLocation")); field = obj->getField(QString("Set")); if (field) m_ahrs->homeLocationSet->setEnabled(field->getValue().toBool()); diff --git a/ground/openpilotgcs/src/plugins/config/configahrswidget.h b/ground/openpilotgcs/src/plugins/config/configahrswidget.h index 81344226e..23da6f242 100644 --- a/ground/openpilotgcs/src/plugins/config/configahrswidget.h +++ b/ground/openpilotgcs/src/plugins/config/configahrswidget.h @@ -55,6 +55,7 @@ public: private: void drawVariancesGraph(); void displayPlane(QString elementID); + virtual void enableControls(bool enable); Ui_AHRSWidget *m_ahrs; QGraphicsSvgItem *paperplane; @@ -130,7 +131,9 @@ private slots: void launchAccelBiasCalibration(); void calibPhase2(); void incrementProgress(); - void ahrsSettingsRequest(); + + virtual void refreshValues(); + //void ahrsSettingsRequest(); void ahrsSettingsSaveRAM(); void ahrsSettingsSaveSD(); void savePositionData(); diff --git a/ground/openpilotgcs/src/plugins/config/configairframewidget.cpp b/ground/openpilotgcs/src/plugins/config/configairframewidget.cpp index da6dc6afb..bf3a1cfe9 100644 --- a/ground/openpilotgcs/src/plugins/config/configairframewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configairframewidget.cpp @@ -166,14 +166,12 @@ ConfigAirframeWidget::ConfigAirframeWidget(QWidget *parent) : ConfigTaskWidget(p connect(m_aircraft->saveAircraftToSD, SIGNAL(clicked()), this, SLOT(saveAircraftUpdate())); connect(m_aircraft->saveAircraftToRAM, SIGNAL(clicked()), this, SLOT(sendAircraftUpdate())); - connect(m_aircraft->getAircraftCurrent, SIGNAL(clicked()), this, SLOT(requestAircraftUpdate())); + connect(m_aircraft->ffSave, SIGNAL(clicked()), this, SLOT(saveAircraftUpdate())); connect(m_aircraft->ffApply, SIGNAL(clicked()), this, SLOT(sendAircraftUpdate())); - connect(m_aircraft->ffGetCurrent, SIGNAL(clicked()), this, SLOT(requestAircraftUpdate())); connect(m_aircraft->fixedWingType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); connect(m_aircraft->multirotorFrameType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); connect(m_aircraft->aircraftType, SIGNAL(currentIndexChanged(int)), this, SLOT(switchAirframeType(int))); - requestAircraftUpdate(); connect(m_aircraft->fwThrottleReset, SIGNAL(clicked()), this, SLOT(resetFwMixer())); connect(m_aircraft->mrThrottleCurveReset, SIGNAL(clicked()), this, SLOT(resetMrMixer())); @@ -192,10 +190,22 @@ ConfigAirframeWidget::ConfigAirframeWidget(QWidget *parent) : ConfigTaskWidget(p connect(m_aircraft->ffTestBox2, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); connect(m_aircraft->ffTestBox3, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); - connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestAircraftUpdate())); + enableControls(false); + refreshValues(); + connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect())); + connect(parent, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect())); + + // Register for ManualControlSettings changes: + obj = dynamic_cast(getObjectManager()->getObject(QString("SystemSettings"))); + connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues())); + obj = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); + connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues())); + obj = dynamic_cast(getObjectManager()->getObject(QString("ActuatorSettings"))); + connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues())); // Connect the help button connect(m_aircraft->airframeHelp, SIGNAL(clicked()), this, SLOT(openHelp())); + } ConfigAirframeWidget::~ConfigAirframeWidget() @@ -203,6 +213,18 @@ ConfigAirframeWidget::~ConfigAirframeWidget() // Do nothing } +/** + Enable or disable controls depending on whether we're ronnected or not + */ +void ConfigAirframeWidget::enableControls(bool enable) +{ + //m_aircraft->saveAircraftToRAM->setEnabled(enable); + m_aircraft->saveAircraftToSD->setEnabled(enable); + //m_aircraft->ffApply->setEnabled(enable); + m_aircraft->ffSave->setEnabled(enable); +} + + /** Slot for switching the airframe type. We do it explicitely rather than a signal in the UI, because we want to force a fitInView of the quad shapes. @@ -440,14 +462,13 @@ void ConfigAirframeWidget::updateCustomThrottle2CurveValue(QList list, d * Aircraft settings **************************/ /** - Request the current value of the SystemSettings which holds the aircraft type + Refreshes the current value of the SystemSettings which holds the aircraft type */ -void ConfigAirframeWidget::requestAircraftUpdate() +void ConfigAirframeWidget::refreshValues() { // Get the Airframe type from the system settings: UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("SystemSettings"))); Q_ASSERT(obj); - obj->requestUpdate(); UAVObjectField *field = obj->getField(QString("AirframeType")); Q_ASSERT(field); // At this stage, we will need to have some hardcoded settings in this code, this @@ -457,7 +478,6 @@ void ConfigAirframeWidget::requestAircraftUpdate() obj = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); Q_ASSERT(obj); - obj->requestUpdate(); field = obj->getField(QString("ThrottleCurve1")); Q_ASSERT(field); QList curveValues; @@ -1524,7 +1544,7 @@ bool ConfigAirframeWidget::setupMixer(double mixerFactors[8][3]) setupQuadMotor(channel, mixerFactors[i][0]*pFactor, rFactor*mixerFactors[i][1], yFactor*mixerFactors[i][2]); } - obj->updated(); +// obj->updated(); return true; } @@ -1568,7 +1588,7 @@ void ConfigAirframeWidget::setupMotors(QList motorList) field = obj->getField(motor); field->setValue(mmList.takeFirst()->currentText()); } - obj->updated(); // Save... + //obj->updated(); // Save... } @@ -2026,14 +2046,12 @@ void ConfigAirframeWidget::sendAircraftUpdate() m_aircraft->mrStatusLabel->setText("Error: Assign a Yaw channel"); return; } + motorList << "VTOLMotorNW" << "VTOLMotorNE" << "VTOLMotorS"; + setupMotors(motorList); obj = dynamic_cast(getObjectManager()->getObject(QString("ActuatorSettings"))); Q_ASSERT(obj); field = obj->getField("FixedWingYaw1"); field->setValue(m_aircraft->triYawChannel->currentText()); - // No need to send a obj->updated() here because setupMotors - // will do it. - motorList << "VTOLMotorNW" << "VTOLMotorNE" << "VTOLMotorS"; - setupMotors(motorList); // Motor 1 to 6, Y6 Layout: // pitch roll yaw @@ -2112,10 +2130,13 @@ void ConfigAirframeWidget::sendAircraftUpdate() field->setValue(m_aircraft->customMixerTable->item(5,i)->text(),ti); } - obj->updated(); } - UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("SystemSettings"))); + UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("ActuatorSettings"))); + obj->updated(); + obj = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); + obj->updated(); + obj = dynamic_cast(getObjectManager()->getObject(QString("SystemSettings"))); UAVObjectField* field = obj->getField(QString("AirframeType")); field->setValue(airframeType); obj->updated(); diff --git a/ground/openpilotgcs/src/plugins/config/configairframewidget.h b/ground/openpilotgcs/src/plugins/config/configairframewidget.h index 37f6ef877..19b5c35e8 100644 --- a/ground/openpilotgcs/src/plugins/config/configairframewidget.h +++ b/ground/openpilotgcs/src/plugins/config/configairframewidget.h @@ -32,6 +32,7 @@ #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" +#include "uavtalk/telemetrymanager.h" #include #include #include @@ -57,6 +58,7 @@ private: void updateCustomAirframeUI(); bool setupMixer(double mixerFactors[8][3]); void setupMotors(QList motorList); + virtual void enableControls(bool enable); void resetField(UAVObjectField * field); void resetMixer (MixerCurveWidget *mixer, int numElements); @@ -72,7 +74,7 @@ private: UAVObject::Metadata accInitialData; private slots: - void requestAircraftUpdate(); + virtual void refreshValues(); void sendAircraftUpdate(); void saveAircraftUpdate(); void setupAirframeUI(QString type); diff --git a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp index 2a15bf0cf..52488da19 100644 --- a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp @@ -41,14 +41,20 @@ ConfigCCAttitudeWidget::ConfigCCAttitudeWidget(QWidget *parent) : connect(ui->zeroBias,SIGNAL(clicked()),this,SLOT(startAccelCalibration())); connect(ui->saveButton,SIGNAL(clicked()),this,SLOT(saveAttitudeSettings())); connect(ui->applyButton,SIGNAL(clicked()),this,SLOT(applyAttitudeSettings())); - connect(ui->getCurrentButton,SIGNAL(clicked()),this,SLOT(getCurrentAttitudeSettings())); // Make it smart: - connect(parent, SIGNAL(autopilotConnected()),this, SLOT(getCurrentAttitudeSettings())); - getCurrentAttitudeSettings(); // The 1st time this panel is instanciated, the autopilot is already connected. + connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect())); + connect(parent, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect())); + + enableControls(true); + refreshValues(); // The 1st time this panel is instanciated, the autopilot is already connected. + UAVObject * settings = getObjectManager()->getObject(QString("AttitudeSettings")); + connect(settings,SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshValues())); // Connect the help button connect(ui->ccAttitudeHelp, SIGNAL(clicked()), this, SLOT(openHelp())); + + } ConfigCCAttitudeWidget::~ConfigCCAttitudeWidget() @@ -56,6 +62,12 @@ ConfigCCAttitudeWidget::~ConfigCCAttitudeWidget() delete ui; } +void ConfigCCAttitudeWidget::enableControls(bool enable) +{ + //ui->applyButton->setEnabled(enable); + ui->saveButton->setEnabled(enable); +} + void ConfigCCAttitudeWidget::attitudeRawUpdated(UAVObject * obj) { QMutexLocker locker(&startStop); @@ -126,9 +138,8 @@ void ConfigCCAttitudeWidget::applyAttitudeSettings() { settings->updated(); } -void ConfigCCAttitudeWidget::getCurrentAttitudeSettings() { +void ConfigCCAttitudeWidget::refreshValues() { UAVDataObject * settings = dynamic_cast(getObjectManager()->getObject(QString("AttitudeSettings"))); - settings->requestUpdate(); UAVObjectField * field = settings->getField("BoardRotation"); ui->rollBias->setValue(field->getDouble(0)); ui->pitchBias->setValue(field->getDouble(1)); diff --git a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.h b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.h index 1a2627c84..1dee369f7 100644 --- a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.h +++ b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.h @@ -52,7 +52,7 @@ private slots: void startAccelCalibration(); void saveAttitudeSettings(); void applyAttitudeSettings(); - void getCurrentAttitudeSettings(); + virtual void refreshValues(); void openHelp(); private: @@ -67,6 +67,8 @@ private: static const int NUM_ACCEL_UPDATES = 60; static const float ACCEL_SCALE = 0.004f * 9.81f; + virtual void enableControls(bool enable); + }; #endif // CCATTITUDEWIDGET_H diff --git a/ground/openpilotgcs/src/plugins/config/configccpmwidget.cpp b/ground/openpilotgcs/src/plugins/config/configccpmwidget.cpp index a1b652a2e..2dd554a63 100644 --- a/ground/openpilotgcs/src/plugins/config/configccpmwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configccpmwidget.cpp @@ -1250,11 +1250,9 @@ void ConfigccpmWidget::saveccpmUpdate() ShowDisclaimer(0); // Send update so that the latest value is saved sendccpmUpdate(); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - UAVObjectManager *objManager = pm->getObject(); - UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("MixerSettings"))); + UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("MixerSettings"))); Q_ASSERT(obj); - updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj); + saveObjectToSD(obj); } void ConfigccpmWidget::resizeEvent(QResizeEvent* event) @@ -1331,7 +1329,7 @@ void ConfigccpmWidget::SwashLvlStartButtonPressed() // Get the channel assignements: obj = dynamic_cast(objManager->getObject(QString("ActuatorSettings"))); Q_ASSERT(obj); - obj->requestUpdate(); + // obj->requestUpdate(); MinField = obj->getField(QString("ChannelMin")); NeutralField = obj->getField(QString("ChannelNeutral")); MaxField = obj->getField(QString("ChannelMax")); @@ -1561,8 +1559,7 @@ void ConfigccpmWidget::SwashLvlFinishButtonPressed() } obj->updated(); - - updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj); + saveObjectToSD(obj); //restore Flight control of ActuatorCommand enableSwashplateLevellingControl(false); @@ -1591,7 +1588,7 @@ int ConfigccpmWidget::ShowDisclaimer(int messageID) break; case 1: // Not Tested disclaimer - msgBox.setInformativeText("

The CCPM mixer code has not been used to fly a helicopter!

Use it at your own risk!

Do you wish to continue?"); + msgBox.setInformativeText("

The CCPM mixer code needs more testing!

Use it at your own risk!

Do you wish to continue?"); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Cancel); msgBox.setIcon(QMessageBox::Warning); diff --git a/ground/openpilotgcs/src/plugins/config/configccpmwidget.h b/ground/openpilotgcs/src/plugins/config/configccpmwidget.h index 7eb95a5f1..12390a0f2 100644 --- a/ground/openpilotgcs/src/plugins/config/configccpmwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configccpmwidget.h @@ -85,6 +85,7 @@ private: int MixerChannelData[6]; int ShowDisclaimer(int messageID); + virtual void enableControls(bool enable) { Q_UNUSED(enable)}; // Not used by this widget private slots: void ccpmSwashplateUpdate(); @@ -109,10 +110,14 @@ private: void setSwashplateLevel(int percent); void SwashLvlSpinBoxChanged(int value); void FocusChanged(QWidget *oldFocus, QWidget *newFocus); + + virtual void refreshValues() {}; // Not used + public slots: void requestccpmUpdate(); void sendccpmUpdate(); void saveccpmUpdate(); + protected: void showEvent(QShowEvent *event); void resizeEvent(QResizeEvent *event); diff --git a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp index b49ccf1df..f19b414c4 100644 --- a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp @@ -90,10 +90,11 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent) ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); TelemetryManager* telMngr = pm->getObject(); connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect())); + connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect())); // And check whether by any chance we are not already connected if (telMngr->isConnected()) - onAutopilotConnect(); + onAutopilotConnect(); help = 0; } @@ -111,6 +112,10 @@ void ConfigGadgetWidget::resizeEvent(QResizeEvent *event) QWidget::resizeEvent(event); } +void ConfigGadgetWidget::onAutopilotDisconnect() { + emit autopilotDisconnected(); +} + void ConfigGadgetWidget::onAutopilotConnect() { // First of all, check what Board type we are talking to, and @@ -135,8 +140,6 @@ void ConfigGadgetWidget::onAutopilotConnect() { ftw->insertTab(3, qwd, QIcon(":/configgadget/images/AHRS-v1.3.png"), QString("INS")); } } - - emit autopilotConnected(); } diff --git a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h index 2520458eb..43db58429 100644 --- a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h @@ -52,9 +52,11 @@ public: public slots: void onAutopilotConnect(); + void onAutopilotDisconnect(); signals: void autopilotConnected(); + void autopilotDisconnected(); protected: void resizeEvent(QResizeEvent * event); diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp index 9ee8f6bb7..da1038c03 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp @@ -38,13 +38,15 @@ #include #include +#include "manualcontrolsettings.h" + ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent) { m_config = new Ui_InputWidget(); m_config->setupUi(this); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - UAVObjectManager *objManager = pm->getObject(); + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + UAVObjectManager *objManager = pm->getObject(); // First of all, put all the channel widgets into lists, so that we can // manipulate those: @@ -68,15 +70,6 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent) << m_config->ch6Min << m_config->ch7Min; - inNeuLabels << m_config->ch0Cur - << m_config->ch1Cur - << m_config->ch2Cur - << m_config->ch3Cur - << m_config->ch4Cur - << m_config->ch5Cur - << m_config->ch6Cur - << m_config->ch7Cur; - inSliders << m_config->inSlider0 << m_config->inSlider1 << m_config->inSlider2 @@ -95,12 +88,24 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent) << m_config->ch6Rev << m_config->ch7Rev; + inChannelAssign << m_config->ch0Assign + << m_config->ch1Assign + << m_config->ch2Assign + << m_config->ch3Assign + << m_config->ch4Assign + << m_config->ch5Assign + << m_config->ch6Assign + << m_config->ch7Assign; // Now connect the widget to the ManualControlCommand / Channel UAVObject - UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("ManualControlCommand"))); connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateChannels(UAVObject*))); + // Register for ManualControlSettings changes: + obj = dynamic_cast(objManager->getObject(QString("ManualControlSettings"))); + connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues())); + + // Get the receiver types supported by OpenPilot and fill the corresponding // dropdown menu: obj = dynamic_cast(objManager->getObject(QString("ManualControlSettings"))); @@ -151,22 +156,14 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent) m_config->armControl->clear(); m_config->armControl->addItems(field->getOptions()); - requestRCInputUpdate(); connect(m_config->saveRCInputToSD, SIGNAL(clicked()), this, SLOT(saveRCInputObject())); connect(m_config->saveRCInputToRAM, SIGNAL(clicked()), this, SLOT(sendRCInputUpdate())); - connect(m_config->getRCInputCurrent, SIGNAL(clicked()), this, SLOT(requestRCInputUpdate())); - connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestRCInputUpdate())); - - connect(m_config->inSlider0, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged0(int))); - connect(m_config->inSlider1, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged1(int))); - connect(m_config->inSlider2, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged2(int))); - connect(m_config->inSlider3, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged3(int))); - connect(m_config->inSlider4, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged4(int))); - connect(m_config->inSlider5, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged5(int))); - connect(m_config->inSlider6, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged6(int))); - connect(m_config->inSlider7, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged7(int))); + enableControls(false); + refreshValues(); + connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect())); + connect(parent, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect())); connect(m_config->ch0Rev, SIGNAL(toggled(bool)), this, SLOT(reverseCheckboxClicked(bool))); connect(m_config->ch1Rev, SIGNAL(toggled(bool)), this, SLOT(reverseCheckboxClicked(bool))); @@ -179,19 +176,6 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent) firstUpdate = true; - enableControls(false); - - // Listen to telemetry connection events - if (pm) { - TelemetryManager *tm = pm->getObject(); - if (tm) { - connect(tm, SIGNAL(myStart()), this, SLOT(onTelemetryStart())); - connect(tm, SIGNAL(myStop()), this, SLOT(onTelemetryStop())); - connect(tm, SIGNAL(connected()), this, SLOT(onTelemetryConnect())); - connect(tm, SIGNAL(disconnected()), this, SLOT(onTelemetryDisconnect())); - } - } - // Connect the help button connect(m_config->inputHelp, SIGNAL(clicked()), this, SLOT(openHelp())); } @@ -219,89 +203,19 @@ void ConfigInputWidget::reverseCheckboxClicked(bool state) } } -// ************************************ -// slider value changed signals - -void ConfigInputWidget::onInSliderValueChanged0(int value) -{ - inNeuLabels[0]->setText(QString::number(value)); -} - -void ConfigInputWidget::onInSliderValueChanged1(int value) -{ - inNeuLabels[1]->setText(QString::number(value)); -} - -void ConfigInputWidget::onInSliderValueChanged2(int value) -{ - inNeuLabels[2]->setText(QString::number(value)); -} - -void ConfigInputWidget::onInSliderValueChanged3(int value) -{ - inNeuLabels[3]->setText(QString::number(value)); -} - -void ConfigInputWidget::onInSliderValueChanged4(int value) -{ - inNeuLabels[4]->setText(QString::number(value)); -} - -void ConfigInputWidget::onInSliderValueChanged5(int value) -{ - inNeuLabels[5]->setText(QString::number(value)); -} - -void ConfigInputWidget::onInSliderValueChanged6(int value) -{ - inNeuLabels[6]->setText(QString::number(value)); -} - -void ConfigInputWidget::onInSliderValueChanged7(int value) -{ - inNeuLabels[7]->setText(QString::number(value)); -} - -// ************************************ -// telemetry start/stop connect/disconnect signals - -void ConfigInputWidget::onTelemetryStart() -{ -} - -void ConfigInputWidget::onTelemetryStop() -{ -} - -void ConfigInputWidget::onTelemetryConnect() -{ - enableControls(true); -} - -void ConfigInputWidget::onTelemetryDisconnect() -{ - enableControls(false); - m_config->doRCInputCalibration->setChecked(false); -} // ************************************ +/* + Enable or disable some controls depending on whether we are connected + or not to the board. Actually, this i mostly useless IMHO, I don't + know who added this into the code (Ed's note) + */ void ConfigInputWidget::enableControls(bool enable) { - m_config->getRCInputCurrent->setEnabled(enable); - m_config->saveRCInputToRAM->setEnabled(enable); + //m_config->saveRCInputToRAM->setEnabled(enable); m_config->saveRCInputToSD->setEnabled(enable); - m_config->doRCInputCalibration->setEnabled(enable); - - m_config->ch0Assign->setEnabled(enable); - m_config->ch1Assign->setEnabled(enable); - m_config->ch2Assign->setEnabled(enable); - m_config->ch3Assign->setEnabled(enable); - m_config->ch4Assign->setEnabled(enable); - m_config->ch5Assign->setEnabled(enable); - m_config->ch6Assign->setEnabled(enable); - m_config->ch7Assign->setEnabled(enable); } @@ -312,11 +226,11 @@ void ConfigInputWidget::enableControls(bool enable) /** Request the current config from the board */ -void ConfigInputWidget::requestRCInputUpdate() +void ConfigInputWidget::refreshValues() { UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("ManualControlSettings"))); Q_ASSERT(obj); - obj->requestUpdate(); + //obj->requestUpdate(); UAVObjectField *field; // Now update all the slider values: @@ -350,14 +264,9 @@ void ConfigInputWidget::requestRCInputUpdate() m_config->receiverType->setCurrentIndex(m_config->receiverType->findText(field->getValue().toString())); // Reset all channel assignement dropdowns: - m_config->ch0Assign->setCurrentIndex(0); - m_config->ch1Assign->setCurrentIndex(0); - m_config->ch2Assign->setCurrentIndex(0); - m_config->ch3Assign->setCurrentIndex(0); - m_config->ch4Assign->setCurrentIndex(0); - m_config->ch5Assign->setCurrentIndex(0); - m_config->ch6Assign->setCurrentIndex(0); - m_config->ch7Assign->setCurrentIndex(0); + foreach (QComboBox *combo, inChannelAssign) { + combo->setCurrentIndex(0); + } // Update all channels assignements QList fieldList = obj->getFields(); @@ -508,11 +417,9 @@ void ConfigInputWidget::saveRCInputObject() { // Send update so that the latest value is saved sendRCInputUpdate(); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - UAVObjectManager *objManager = pm->getObject(); - UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("ManualControlSettings"))); + UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("ManualControlSettings"))); Q_ASSERT(obj); - updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj); + saveObjectToSD(obj); } @@ -567,35 +474,38 @@ void ConfigInputWidget::updateChannels(UAVObject* controlCommand) if (m_config->doRCInputCalibration->isChecked()) { if (firstUpdate) { - // Increase the data rate from the board so that the sliders - // move faster - UAVObject::Metadata mdata = controlCommand->getMetadata(); - mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC; - mccDataRate = mdata.flightTelemetryUpdatePeriod; - mdata.flightTelemetryUpdatePeriod = 150; - controlCommand->setMetadata(mdata); - - // Also protect the user by setting all values to zero - // and making the ActuatorCommand object readonly - UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("ActuatorCommand"))); - mdata = obj->getMetadata(); - mdata.flightAccess = UAVObject::ACCESS_READONLY; - obj->setMetadata(mdata); - UAVObjectField *field = obj->getField("Channel"); - for (int i=0; i< field->getNumElements(); i++) { - field->setValue(0,i); - } - obj->updated(); + // Increase the data rate from the board so that the sliders + // move faster + UAVObject::Metadata mdata = controlCommand->getMetadata(); + mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC; + mccDataRate = mdata.flightTelemetryUpdatePeriod; + mdata.flightTelemetryUpdatePeriod = 150; + controlCommand->setMetadata(mdata); + // Also protect the user by setting all values to zero + // and making the ActuatorCommand object readonly + UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("ActuatorCommand"))); + mdata = obj->getMetadata(); + mdata.flightAccess = UAVObject::ACCESS_READONLY; + obj->setMetadata(mdata); + UAVObjectField *field = obj->getField("Channel"); + for (uint i=0; i< field->getNumElements(); i++) { + field->setValue(0,i); } + obj->updated(); + + // Last, make sure the user won't apply/save during calibration + m_config->saveRCInputToRAM->setEnabled(false); + m_config->saveRCInputToSD->setEnabled(false); + } field = controlCommand->getField(QString("Channel")); for (int i = 0; i < 8; i++) updateChannelInSlider(inSliders[i], inMinLabels[i], inMaxLabels[i], field->getValue(i).toInt(),inRevCheckboxes[i]->isChecked()); firstUpdate = false; - } - else { - if (!firstUpdate) { + } + else { + if (!firstUpdate) { // Restore original data rate from the board: UAVObject::Metadata mdata = controlCommand->getMetadata(); mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC; @@ -606,44 +516,83 @@ void ConfigInputWidget::updateChannels(UAVObject* controlCommand) mdata = obj->getMetadata(); mdata.flightAccess = UAVObject::ACCESS_READWRITE; obj->setMetadata(mdata); + + // Set some slider values to better defaults + // Find what channel we used for throttle, set it 5% about min: + int throttleChannel = -1; + int fmChannel = -1; + for (int i=0; i < inChannelAssign.length(); i++) { + if (inChannelAssign.at(i)->currentText() == "Throttle") { + // TODO: this is very ugly, because this relies on the name of the + // channel input, everywhere else in the gadget we don't rely on the + // naming... + throttleChannel = i; + } + if (inChannelAssign.at(i)->currentText() == "FlightMode") { + // TODO: this is very ugly, because this relies on the name of the + // channel input, everywhere else in the gadget we don't rely on the + // naming... + fmChannel = i; + } + } + + // Throttle neutral defaults to 2% of range + if (throttleChannel > -1) { + inSliders.at(throttleChannel)->setValue( + inSliders.at(throttleChannel)->minimum() + + (inSliders.at(throttleChannel)->maximum()- + inSliders.at(throttleChannel)->minimum())*0.02); + } + + // Flight mode at 50% of range: + if (fmChannel > -1) { + inSliders.at(fmChannel)->setValue( + inSliders.at(fmChannel)->minimum()+ + (inSliders.at(fmChannel)->maximum()- + inSliders.at(fmChannel)->minimum())*0.5); + } + + m_config->saveRCInputToRAM->setEnabled(true); + m_config->saveRCInputToSD->setEnabled(true); } firstUpdate = true; } + //Update the Flight mode channel slider - UAVObject* obj = getObjectManager()->getObject("ManualControlSettings"); - // Find the channel currently assigned to flightmode - field = obj->getField("FlightMode"); - int chIndex = field->getOptions().indexOf(field->getValue().toString()); - if (chIndex < field->getOptions().length() - 1) { + ManualControlSettings * manualSettings = ManualControlSettings::GetInstance(getObjectManager()); + ManualControlSettings::DataFields manualSettingsData = manualSettings->getData(); + uint chIndex = manualSettingsData.FlightMode; + if (chIndex < manualSettings->FLIGHTMODE_NONE) { float valueScaled; - int chMin = inSliders[chIndex]->minimum(); - int chMax = inSliders[chIndex]->maximum(); - int chNeutral = inSliders[chIndex]->value(); + int chMin = manualSettingsData.ChannelMin[chIndex]; + int chMax = manualSettingsData.ChannelMax[chIndex]; + int chNeutral = manualSettingsData.ChannelNeutral[chIndex]; int value = controlCommand->getField("Channel")->getValue(chIndex).toInt(); if ((chMax > chMin && value >= chNeutral) || (chMin > chMax && value <= chNeutral)) { - if (chMax != chNeutral) - valueScaled = (float)(value - chNeutral) / (float)(chMax - chNeutral); - else - valueScaled = 0; + if (chMax != chNeutral) + valueScaled = (float)(value - chNeutral) / (float)(chMax - chNeutral); + else + valueScaled = 0; } else { - if (chMin != chNeutral) - valueScaled = (float)(value - chNeutral) / (float)(chNeutral - chMin); - else - valueScaled = 0; + if (chMin != chNeutral) + valueScaled = (float)(value - chNeutral) / (float)(chNeutral - chMin); + else + valueScaled = 0; } - // Bound - if (valueScaled > 1.0) valueScaled = 1.0; - else - if (valueScaled < -1.0) valueScaled = -1.0; + if(valueScaled < -(1.0 / 3.0)) + m_config->fmsSlider->setValue(-100); + else if (valueScaled > (1.0/3.0)) + m_config->fmsSlider->setValue(100); + else + m_config->fmsSlider->setValue(0); - m_config->fmsSlider->setValue(valueScaled * 100); - } + } } void ConfigInputWidget::updateChannelInSlider(QSlider *slider, QLabel *min, QLabel *max, int value, bool reversed) diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.h b/ground/openpilotgcs/src/plugins/config/configinputwidget.h index 5747ee35d..3017c5677 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.h @@ -46,19 +46,6 @@ public: ~ConfigInputWidget(); public slots: - void onTelemetryStart(); - void onTelemetryStop(); - void onTelemetryConnect(); - void onTelemetryDisconnect(); - - void onInSliderValueChanged0(int value); - void onInSliderValueChanged1(int value); - void onInSliderValueChanged2(int value); - void onInSliderValueChanged3(int value); - void onInSliderValueChanged4(int value); - void onInSliderValueChanged5(int value); - void onInSliderValueChanged6(int value); - void onInSliderValueChanged7(int value); private: Ui_InputWidget *m_config; @@ -79,14 +66,15 @@ private: QList inMinLabels; QList inNeuLabels; QList inRevCheckboxes; + QList inChannelAssign; bool firstUpdate; - void enableControls(bool enable); + virtual void enableControls(bool enable); private slots: void updateChannels(UAVObject* obj); - void requestRCInputUpdate(); + virtual void refreshValues(); void sendRCInputUpdate(); void saveRCInputObject(); void reverseCheckboxClicked(bool state); diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp index 27858e111..1a961805b 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp @@ -97,18 +97,17 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren << m_config->ch7Rev; links << m_config->ch0Link - << m_config->ch1Link - << m_config->ch2Link - << m_config->ch3Link - << m_config->ch4Link - << m_config->ch5Link - << m_config->ch6Link - << m_config->ch7Link; + << m_config->ch1Link + << m_config->ch2Link + << m_config->ch3Link + << m_config->ch4Link + << m_config->ch5Link + << m_config->ch6Link + << m_config->ch7Link; // Register for ActuatorSettings changes: UAVDataObject * obj = dynamic_cast(objManager->getObject(QString("ActuatorSettings"))); - connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(requestRCOutputUpdate())); - + connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues())); for (int i = 0; i < 8; i++) { connect(outMin[i], SIGNAL(editingFinished()), this, SLOT(setChOutRange())); @@ -120,41 +119,23 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren connect(m_config->channelOutTest, SIGNAL(toggled(bool)), this, SLOT(runChannelTests(bool))); - for (int i = 0; i < links.count(); i++) - links[i]->setChecked(false); - for (int i = 0; i < links.count(); i++) - connect(links[i], SIGNAL(toggled(bool)), this, SLOT(linkToggled(bool))); - - requestRCOutputUpdate(); + for (int i = 0; i < links.count(); i++) + links[i]->setChecked(false); + for (int i = 0; i < links.count(); i++) + connect(links[i], SIGNAL(toggled(bool)), this, SLOT(linkToggled(bool))); connect(m_config->saveRCOutputToSD, SIGNAL(clicked()), this, SLOT(saveRCOutputObject())); connect(m_config->saveRCOutputToRAM, SIGNAL(clicked()), this, SLOT(sendRCOutputUpdate())); - // Actually, this is not really needed since we are subscribing to the object updates already - // TODO: remove those buttons on all config gadget panels. - connect(m_config->getRCOutputCurrent, SIGNAL(clicked()), this, SLOT(requestRCOutputUpdate())); - - connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestRCOutputUpdate())); + enableControls(false); + refreshValues(); + connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect())); + connect(parent, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect())); firstUpdate = true; connect(m_config->spinningArmed, SIGNAL(toggled(bool)), this, SLOT(setSpinningArmed(bool))); - enableControls(false); - - // Listen to telemetry connection events - if (pm) - { - TelemetryManager *tm = pm->getObject(); - if (tm) - { - connect(tm, SIGNAL(myStart()), this, SLOT(onTelemetryStart())); - connect(tm, SIGNAL(myStop()), this, SLOT(onTelemetryStop())); - connect(tm, SIGNAL(connected()), this, SLOT(onTelemetryConnect())); - connect(tm, SIGNAL(disconnected()), this, SLOT(onTelemetryDisconnect())); - } - } - // Connect the help button connect(m_config->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp())); } @@ -165,35 +146,12 @@ ConfigOutputWidget::~ConfigOutputWidget() } - -// ************************************ -// telemetry start/stop connect/disconnect signals - -void ConfigOutputWidget::onTelemetryStart() -{ -} - -void ConfigOutputWidget::onTelemetryStop() -{ -} - -void ConfigOutputWidget::onTelemetryConnect() -{ - enableControls(true); -} - -void ConfigOutputWidget::onTelemetryDisconnect() -{ - enableControls(false); -} - // ************************************ void ConfigOutputWidget::enableControls(bool enable) { m_config->saveRCOutputToSD->setEnabled(enable); - m_config->saveRCOutputToRAM->setEnabled(enable); - m_config->getRCOutputCurrent->setEnabled(enable); + //m_config->saveRCOutputToRAM->setEnabled(enable); } // ************************************ @@ -203,29 +161,30 @@ void ConfigOutputWidget::enableControls(bool enable) */ void ConfigOutputWidget::linkToggled(bool state) { - // find the minimum slider value for the linked ones - int min = 10000; - int linked_count = 0; - for (int i = 0; i < outSliders.count(); i++) - { - if (!links[i]->checkState()) continue; - int value = outSliders[i]->value(); - if (min > value) min = value; - linked_count++; - } + Q_UNUSED(state) + // find the minimum slider value for the linked ones + int min = 10000; + int linked_count = 0; + for (int i = 0; i < outSliders.count(); i++) + { + if (!links[i]->checkState()) continue; + int value = outSliders[i]->value(); + if (min > value) min = value; + linked_count++; + } - if (linked_count <= 0) - return; // no linked channels + if (linked_count <= 0) + return; // no linked channels - if (!m_config->channelOutTest->checkState()) - return; // we are not in Test Output mode + if (!m_config->channelOutTest->checkState()) + return; // we are not in Test Output mode - // set the linked channels to the same value - for (int i = 0; i < outSliders.count(); i++) - { - if (!links[i]->checkState()) continue; - outSliders[i]->setValue(min); - } + // set the linked channels to the same value + for (int i = 0; i < outSliders.count(); i++) + { + if (!links[i]->checkState()) continue; + outSliders[i]->setValue(min); + } } /** @@ -237,7 +196,7 @@ void ConfigOutputWidget::runChannelTests(bool state) // Confirm this is definitely what they want if(state) { QMessageBox mbox; - mbox.setText(QString(tr("This option will requires you to be in the armed state and will start your motors by the amount selected on the sliders. It is recommended to remove any blades from motors. Are you sure you want to do this?"))); + mbox.setText(QString(tr("This option will start your motors by the amount selected on the sliders regardless of transmitter. It is recommended to remove any blades from motors. Are you sure you want to do this?"))); mbox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); int retval = mbox.exec(); if(retval != QMessageBox::Yes) { @@ -396,7 +355,7 @@ void ConfigOutputWidget::sendChannelTest(int value) /** Request the current config from the board (RC Output) */ -void ConfigOutputWidget::requestRCOutputUpdate() +void ConfigOutputWidget::refreshValues() { ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); UAVObjectManager *objManager = pm->getObject(); @@ -534,11 +493,9 @@ void ConfigOutputWidget::saveRCOutputObject() { // Send update so that the latest value is saved sendRCOutputUpdate(); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - UAVObjectManager *objManager = pm->getObject(); - UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("ActuatorSettings"))); + UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("ActuatorSettings"))); Q_ASSERT(obj); - updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj); + saveObjectToSD(obj); } @@ -547,8 +504,8 @@ void ConfigOutputWidget::saveRCOutputObject() Sets the minimum/maximum value of the channel 0 to seven output sliders. Have to do it here because setMinimum is not a slot. - One added trick: if the slider is at either its max or its min when the value - is changed, then keep it on the max/min. + One added trick: if the slider is at its min when the value + is changed, then keep it on the min. */ void ConfigOutputWidget::setChOutRange() { @@ -561,7 +518,7 @@ void ConfigOutputWidget::setChOutRange() QSlider *slider = outSliders[index]; int oldMini = slider->minimum(); - int oldMaxi = slider->maximum(); +// int oldMaxi = slider->maximum(); if (outMin[index]->value()value()) { diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h index bb18312f7..2a197e3ac 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h @@ -46,12 +46,6 @@ public: ConfigOutputWidget(QWidget *parent = 0); ~ConfigOutputWidget(); -public slots: - void onTelemetryStart(); - void onTelemetryStop(); - void onTelemetryConnect(); - void onTelemetryDisconnect(); - private: Ui_OutputWidget *m_config; @@ -75,10 +69,10 @@ private: bool firstUpdate; - void enableControls(bool enable); + virtual void enableControls(bool enable); private slots: - void requestRCOutputUpdate(); + virtual void refreshValues(); void sendRCOutputUpdate(); void saveRCOutputObject(); void runChannelTests(bool state); diff --git a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp index dd172a599..f691cc22f 100644 --- a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp @@ -42,15 +42,18 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa m_stabilization = new Ui_StabilizationWidget(); m_stabilization->setupUi(this); - // Now connect the widget to the ManualControlCommand / Channel UAVObject - //UAVObject *obj = dynamic_cast(getObjectManager()->getObject(QString("StabilizationSettings"))); - requestStabilizationUpdate(); connect(m_stabilization->saveStabilizationToSD, SIGNAL(clicked()), this, SLOT(saveStabilizationUpdate())); connect(m_stabilization->saveStabilizationToRAM, SIGNAL(clicked()), this, SLOT(sendStabilizationUpdate())); - connect(m_stabilization->getStabilizationCurrent, SIGNAL(clicked()), this, SLOT(requestStabilizationUpdate())); - connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestStabilizationUpdate())); + enableControls(false); + refreshValues(); + connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect())); + connect(parent, SIGNAL(autopilotDisconnected()),this, SLOT(onAutopilotDisconnect())); + + // Now connect the widget to the StabilizationSettings object + UAVObject *obj = getObjectManager()->getObject(QString("StabilizationSettings")); + connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues())); // Create a timer to regularly send the object update in case // we want realtime updates. @@ -84,6 +87,12 @@ ConfigStabilizationWidget::~ConfigStabilizationWidget() } +void ConfigStabilizationWidget::enableControls(bool enable) +{ + //m_stabilization->saveStabilizationToRAM->setEnabled(enable); + m_stabilization->saveStabilizationToSD->setEnabled(enable); +} + void ConfigStabilizationWidget::updateRateRollKP(double val) { if (m_stabilization->linkRateRP->isChecked()) { @@ -178,9 +187,11 @@ void ConfigStabilizationWidget::updatePitchILimit(double val) /** Request stabilization settings from the board */ -void ConfigStabilizationWidget::requestStabilizationUpdate() +void ConfigStabilizationWidget::refreshValues() { - stabSettings->requestUpdate(); + // Not needed anymore as this slot is only called whenever we get + // a signal that the object was just updated + // stabSettings->requestUpdate(); StabilizationSettings::DataFields stabData = stabSettings->getData(); // Now fill in all the fields, this is fairly tedious: m_stabilization->rateRollKp->setValue(stabData.RollRatePI[StabilizationSettings::ROLLRATEPI_KP]); @@ -211,6 +222,14 @@ void ConfigStabilizationWidget::requestStabilizationUpdate() m_stabilization->pitchMax->setValue(stabData.PitchMax); m_stabilization->yawMax->setValue(stabData.YawMax); + m_stabilization->manualRoll->setValue(stabData.ManualRate[StabilizationSettings::MANUALRATE_ROLL]); + m_stabilization->manualPitch->setValue(stabData.ManualRate[StabilizationSettings::MANUALRATE_PITCH]); + m_stabilization->manualYaw->setValue(stabData.ManualRate[StabilizationSettings::MANUALRATE_YAW]); + + m_stabilization->maximumRoll->setValue(stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_ROLL]); + m_stabilization->maximumPitch->setValue(stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_PITCH]); + m_stabilization->maximumYaw->setValue(stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_YAW]); + } @@ -250,6 +269,14 @@ void ConfigStabilizationWidget::sendStabilizationUpdate() stabData.PitchMax = m_stabilization->pitchMax->value(); stabData.YawMax = m_stabilization->yawMax->value(); + stabData.ManualRate[StabilizationSettings::MANUALRATE_ROLL] = m_stabilization->manualRoll->value(); + stabData.ManualRate[StabilizationSettings::MANUALRATE_PITCH] = m_stabilization->manualPitch->value(); + stabData.ManualRate[StabilizationSettings::MANUALRATE_YAW] = m_stabilization->manualYaw->value(); + + stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_ROLL] = m_stabilization->maximumRoll->value(); + stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_PITCH] = m_stabilization->maximumPitch->value(); + stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_YAW] = m_stabilization->maximumYaw->value(); + stabSettings->setData(stabData); // this is atomic } @@ -262,20 +289,19 @@ void ConfigStabilizationWidget::saveStabilizationUpdate() { // Send update so that the latest value is saved sendStabilizationUpdate(); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - UAVObjectManager *objManager = pm->getObject(); - UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("StabilizationSettings"))); + UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("StabilizationSettings"))); Q_ASSERT(obj); - updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj); + saveObjectToSD(obj); } void ConfigStabilizationWidget::realtimeUpdateToggle(bool state) { - if (state) + if (state) { updateTimer.start(300); - else + } else { updateTimer.stop(); + } } void ConfigStabilizationWidget::openHelp() diff --git a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h index 5af92ae65..98db5530f 100644 --- a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h @@ -49,9 +49,10 @@ private: Ui_StabilizationWidget *m_stabilization; StabilizationSettings* stabSettings; QTimer updateTimer; + virtual void enableControls(bool enable); private slots: - void requestStabilizationUpdate(); + virtual void refreshValues(); void sendStabilizationUpdate(); void saveStabilizationUpdate(); void realtimeUpdateToggle(bool); diff --git a/ground/openpilotgcs/src/plugins/config/configtaskwidget.cpp b/ground/openpilotgcs/src/plugins/config/configtaskwidget.cpp index 8fb743ef0..bb598cba0 100644 --- a/ground/openpilotgcs/src/plugins/config/configtaskwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configtaskwidget.cpp @@ -30,8 +30,6 @@ ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent) { - saveState = IDLE; - queue.clear(); } ConfigTaskWidget::~ConfigTaskWidget() @@ -41,100 +39,13 @@ ConfigTaskWidget::~ConfigTaskWidget() void ConfigTaskWidget::saveObjectToSD(UAVObject *obj) { - // Add to queue - queue.enqueue(obj); - // If queue length is one, then start sending (call sendNextObject) - // Otherwise, do nothing, it's sending anyway - if (queue.length()==1) - saveNextObject(); - + // saveObjectToSD is now handled by the UAVUtils plugin in one + // central place (and one central queue) + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + UAVObjectUtilManager* utilMngr = pm->getObject(); + utilMngr->saveObjectToSD(obj); } -void ConfigTaskWidget::saveNextObject() -{ - if ( queue.isEmpty() ) - { - return; - } - - Q_ASSERT(saveState == IDLE); - - // Get next object from the queue - UAVObject* obj = queue.head(); - ObjectPersistence* objper = dynamic_cast( getObjectManager()->getObject(ObjectPersistence::NAME) ); - connect(objper, SIGNAL(transactionCompleted(UAVObject*,bool)), this, SLOT(objectPersistenceTransactionCompleted(UAVObject*,bool))); - connect(objper, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(objectPersistenceUpdated(UAVObject *))); - saveState = AWAITING_ACK; - if (obj != NULL) - { - ObjectPersistence::DataFields data; - data.Operation = ObjectPersistence::OPERATION_SAVE; - data.Selection = ObjectPersistence::SELECTION_SINGLEOBJECT; - data.ObjectID = obj->getObjID(); - data.InstanceID = obj->getInstID(); - objper->setData(data); - objper->updated(); - } -} - -/** - * @brief Process the transactionCompleted message from Telemetry indicating request sent successfully - * @param[in] The object just transsacted. Must be ObjectPersistance - * @param[in] success Indicates that the transaction did not time out - * - * After a failed transaction (usually timeout) resends the save request. After a succesful - * transaction will then wait for a save completed update from the autopilot. - */ -void ConfigTaskWidget::objectPersistenceTransactionCompleted(UAVObject* obj, bool success) -{ - if(success) { - Q_ASSERT(obj->getName().compare("ObjectPersistence") == 0); - Q_ASSERT(saveState == AWAITING_ACK); - saveState = AWAITING_COMPLETED; - disconnect(obj, SIGNAL(transactionCompleted(UAVObject*,bool)), this, SLOT(objectPersistenceTransactionCompleted(UAVObject*,bool))); - } else if (!success) { - // Can be caused by timeout errors on sending. Send again. - saveNextObject(); - } -} - -/** - * @brief Process the ObjectPersistence updated message to confirm the right object saved - * then requests next object be saved. - * @param[in] The object just received. Must be ObjectPersistance - */ -void ConfigTaskWidget::objectPersistenceUpdated(UAVObject * obj) -{ - Q_ASSERT(obj->getName().compare("ObjectPersistence") == 0); - if(saveState == AWAITING_COMPLETED) { - // Check flight is saying it completed. This is the only thing flight should do to trigger an update. - Q_ASSERT( obj->getField("Operation")->getValue().toString().compare(QString("Completed")) == 0 ); - - // Check right object saved - UAVObject* savingObj = queue.head(); - Q_ASSERT( obj->getField("ObjectID")->getValue() == savingObj->getObjID() ); - - obj->disconnect(this); - queue.dequeue(); // We can now remove the object, it's done. - saveState = IDLE; - saveNextObject(); - } -} - -void ConfigTaskWidget::updateObjectPersistance(ObjectPersistence::OperationOptions op, UAVObject *obj) -{ - ObjectPersistence* objper = dynamic_cast( getObjectManager()->getObject(ObjectPersistence::NAME) ); - if (obj != NULL) - { - ObjectPersistence::DataFields data; - data.Operation = op; - data.Selection = ObjectPersistence::SELECTION_SINGLEOBJECT; - data.ObjectID = obj->getObjID(); - data.InstanceID = obj->getInstID(); - objper->setData(data); - objper->updated(); - } -} UAVObjectManager* ConfigTaskWidget::getObjectManager() { ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); @@ -151,6 +62,21 @@ double ConfigTaskWidget::listMean(QList list) return accum / list.size(); } +// ************************************ +// telemetry start/stop connect/disconnect signals + +void ConfigTaskWidget::onAutopilotDisconnect() +{ + enableControls(false); +} + +void ConfigTaskWidget::onAutopilotConnect() +{ + enableControls(true); + refreshValues(); +} + + /** @} diff --git a/ground/openpilotgcs/src/plugins/config/configtaskwidget.h b/ground/openpilotgcs/src/plugins/config/configtaskwidget.h index 0650ddb25..6ffe15b70 100644 --- a/ground/openpilotgcs/src/plugins/config/configtaskwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configtaskwidget.h @@ -31,7 +31,7 @@ #include "extensionsystem/pluginmanager.h" #include "uavobjectmanager.h" #include "uavobject.h" -#include "objectpersistence.h" +#include "uavobjectutilmanager.h" #include #include #include @@ -45,20 +45,18 @@ public: ConfigTaskWidget(QWidget *parent = 0); ~ConfigTaskWidget(); void saveObjectToSD(UAVObject *obj); - void updateObjectPersistance(ObjectPersistence::OperationOptions op, UAVObject *obj); UAVObjectManager* getObjectManager(); - static double listMean(QList list); +public slots: + void onAutopilotDisconnect(); + void onAutopilotConnect(); + private slots: - void objectPersistenceTransactionCompleted(UAVObject* obj, bool success); - void objectPersistenceUpdated(UAVObject * obj); + virtual void refreshValues() = 0; private: - QQueue queue; - void saveNextObject(); - enum {IDLE, AWAITING_ACK, AWAITING_COMPLETED} saveState; - + virtual void enableControls(bool enable) = 0; }; diff --git a/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.cpp b/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.cpp index 843f94ffb..2b1a8e873 100644 --- a/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.cpp @@ -43,16 +43,18 @@ ConfigTelemetryWidget::ConfigTelemetryWidget(QWidget *parent) : ConfigTaskWidget ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); UAVObjectManager *objManager = pm->getObject(); - UAVObject *obj = dynamic_cast(objManager->getObject(QString("TelemetrySettings"))); + UAVObject *obj = objManager->getObject(QString("TelemetrySettings")); UAVObjectField *field = obj->getField(QString("Speed")); m_telemetry->telemetrySpeed->addItems(field->getOptions()); - requestTelemetryUpdate(); connect(m_telemetry->saveTelemetryToSD, SIGNAL(clicked()), this, SLOT(saveTelemetryUpdate())); connect(m_telemetry->saveTelemetryToRAM, SIGNAL(clicked()), this, SLOT(sendTelemetryUpdate())); - connect(m_telemetry->getTelemetryCurrent, SIGNAL(clicked()), this, SLOT(requestTelemetryUpdate())); + connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshValues())); - connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestTelemetryUpdate())); + enableControls(false); + refreshValues(); + connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect())); + connect(parent, SIGNAL(autopilotDisconnected()),this, SLOT(onAutopilotDisconnect())); } ConfigTelemetryWidget::~ConfigTelemetryWidget() @@ -65,16 +67,21 @@ ConfigTelemetryWidget::~ConfigTelemetryWidget() * Telemetry Settings *****************************/ +void ConfigTelemetryWidget::enableControls(bool enable) +{ + m_telemetry->saveTelemetryToSD->setEnabled(enable); + //m_telemetry->saveTelemetryToRAM->setEnabled(enable); +} + /** Request telemetry settings from the board */ -void ConfigTelemetryWidget::requestTelemetryUpdate() +void ConfigTelemetryWidget::refreshValues() { ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); UAVObjectManager *objManager = pm->getObject(); UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("TelemetrySettings"))); Q_ASSERT(obj); - obj->requestUpdate(); UAVObjectField *field = obj->getField(QString("Speed")); m_telemetry->telemetrySpeed->setCurrentIndex(m_telemetry->telemetrySpeed->findText(field->getValue().toString())); } @@ -84,9 +91,7 @@ void ConfigTelemetryWidget::requestTelemetryUpdate() */ void ConfigTelemetryWidget::sendTelemetryUpdate() { - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - UAVObjectManager *objManager = pm->getObject(); - UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("TelemetrySettings"))); + UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("TelemetrySettings"))); Q_ASSERT(obj); UAVObjectField* field = obj->getField(QString("Speed")); field->setValue(m_telemetry->telemetrySpeed->currentText()); @@ -100,11 +105,7 @@ void ConfigTelemetryWidget::saveTelemetryUpdate() { // Send update so that the latest value is saved sendTelemetryUpdate(); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - UAVObjectManager *objManager = pm->getObject(); - UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("TelemetrySettings"))); + UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("TelemetrySettings"))); Q_ASSERT(obj); - updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj); + saveObjectToSD(obj); } - - diff --git a/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.h b/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.h index 3f38eef3b..f36ba1a4e 100644 --- a/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.h +++ b/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.h @@ -46,9 +46,10 @@ public: private: Ui_TelemetryWidget *m_telemetry; + void enableControls(bool enable); private slots: - void requestTelemetryUpdate(); + virtual void refreshValues(); void sendTelemetryUpdate(); void saveTelemetryUpdate(); diff --git a/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.cpp b/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.cpp index 8fb68d910..4705bb02e 100644 --- a/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.cpp @@ -31,7 +31,7 @@ #include DefaultAttitudeWidget::DefaultAttitudeWidget(QWidget *parent) : - ConfigTaskWidget(parent), + QWidget(parent), ui(new Ui_defaultattitude) { ui->setupUi(this); diff --git a/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.h b/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.h index 25b8809d4..5541eee37 100644 --- a/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.h +++ b/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.h @@ -38,7 +38,7 @@ class Ui_Widget; -class DefaultAttitudeWidget : public ConfigTaskWidget +class DefaultAttitudeWidget : public QWidget { Q_OBJECT diff --git a/ground/openpilotgcs/src/plugins/config/input.ui b/ground/openpilotgcs/src/plugins/config/input.ui index d3260e150..224424c4e 100644 --- a/ground/openpilotgcs/src/plugins/config/input.ui +++ b/ground/openpilotgcs/src/plugins/config/input.ui @@ -7,7 +7,7 @@ 0 0 557 - 462 + 467 @@ -52,7 +52,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - 1000 + 1500 @@ -160,7 +160,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - 1000 + 1500 @@ -268,7 +268,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - 1000 + 1500 @@ -376,7 +376,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - 1000 + 1500 @@ -484,7 +484,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - 1000 + 1500 @@ -592,7 +592,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - 1000 + 1500 @@ -700,7 +700,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - 1000 + 1500 @@ -912,7 +912,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt;">Current channel value.</span></p></body></html> - 1000 + 1500 @@ -1406,16 +1406,6 @@ if you have not done so already. - - - - Retrieve settings from OpenPilot - - - Get Current - - - @@ -1470,5 +1460,134 @@ Applies and Saves all settings to SD - + + + inSlider0 + valueChanged(int) + ch0Cur + setNum(int) + + + 291 + 93 + + + 150 + 104 + + + + + inSlider1 + valueChanged(int) + ch1Cur + setNum(int) + + + 283 + 137 + + + 160 + 138 + + + + + inSlider2 + valueChanged(int) + ch2Cur + setNum(int) + + + 341 + 163 + + + 156 + 167 + + + + + inSlider3 + valueChanged(int) + ch3Cur + setNum(int) + + + 283 + 211 + + + 159 + 210 + + + + + inSlider4 + valueChanged(int) + ch4Cur + setNum(int) + + + 287 + 239 + + + 156 + 242 + + + + + inSlider5 + valueChanged(int) + ch5Cur + setNum(int) + + + 309 + 272 + + + 164 + 276 + + + + + inSlider6 + valueChanged(int) + ch6Cur + setNum(int) + + + 282 + 300 + + + 144 + 311 + + + + + inSlider7 + valueChanged(int) + ch7Cur + setNum(int) + + + 278 + 339 + + + 168 + 340 + + + + diff --git a/ground/openpilotgcs/src/plugins/config/output.ui b/ground/openpilotgcs/src/plugins/config/output.ui index 4d292204b..0084d11ed 100644 --- a/ground/openpilotgcs/src/plugins/config/output.ui +++ b/ground/openpilotgcs/src/plugins/config/output.ui @@ -1143,16 +1143,6 @@ p, li { white-space: pre-wrap; } - - - - Retrieve settings from OpenPilot - - - Get Current - - - @@ -1225,7 +1215,6 @@ Applies and Saves all settings to SD ch7Rev ch7Link channelOutTest - getRCOutputCurrent saveRCOutputToRAM saveRCOutputToSD diff --git a/ground/openpilotgcs/src/plugins/config/stabilization.ui b/ground/openpilotgcs/src/plugins/config/stabilization.ui index e4ccf1b89..120695b96 100644 --- a/ground/openpilotgcs/src/plugins/config/stabilization.ui +++ b/ground/openpilotgcs/src/plugins/config/stabilization.ui @@ -483,6 +483,12 @@ flying style. + + + 150 + 0 + + 75 @@ -564,6 +570,188 @@ flying style. + + + + + + + 150 + 0 + + + + + 75 + true + + + + Manual rate: + + + + + + + Roll + + + + + + + 300 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Pitch + + + + + + + 300 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Yaw + + + + + + + 300 + + + + + + + + + + + + 150 + 0 + + + + + 75 + true + + + + Maximum rate: + + + + + + + Roll + + + + + + + 300 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Pitch + + + + + + + 300 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Yaw + + + + + + + 300 + + + + + @@ -638,13 +826,6 @@ automatically every 300ms, which will help for fast tuning. - - - - Get Current - - - diff --git a/ground/openpilotgcs/src/plugins/config/telemetry.ui b/ground/openpilotgcs/src/plugins/config/telemetry.ui index 905e2fdb2..0db9c9299 100644 --- a/ground/openpilotgcs/src/plugins/config/telemetry.ui +++ b/ground/openpilotgcs/src/plugins/config/telemetry.ui @@ -22,108 +22,98 @@ QFrame::Raised - - - - 10 - 10 - 361 - 151 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Set the serial speed of your onboard telemetry modem here. It is the speed between the OpenPilot board and the onboard modem, and could be different from the radio link speed.</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"></p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans'; font-size:10pt;">Beware of not locking yourself out! You should only modify this setting when the OpenPilot board is connected through the USB port.</span></p></body></html> - - - - - - 70 - 200 - 131 - 17 - - - - - 11 - 75 - true - - - - Telemetry speed: - - - - - - 200 - 190 - 141 - 31 - - - - Select the speed here. - - - - - - 190 - 280 - 93 - 27 - - - - Send to OpenPilot but don't write in SD. + + + + + + + + + + 11 + 75 + true + + + + Telemetry speed: + + + + + + + Select the speed here. + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Send to OpenPilot but don't write in SD. Beware of not locking yourself out! - - - Apply - - - - - - 80 - 280 - 93 - 27 - - - - Retrieve settings from OpenPilot - - - Get Current - - - - - - 300 - 280 - 93 - 27 - - - - Applies and Saves all settings to SD. + + + Apply + + + + + + + Applies and Saves all settings to SD. Beware of not locking yourself out! - - - Save - - + + + Save + + + + + + diff --git a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp index 07f0ef0c9..176263d04 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.cpp @@ -219,8 +219,9 @@ void ConnectionManager::aboutToRemoveObject(QObject *obj) void ConnectionManager::onConnectionDestroyed(QObject *obj) // Pip { - //onConnectionClosed(obj); - disconnectDevice(); + Q_UNUSED(obj) + //onConnectionClosed(obj); + disconnectDevice(); } /** diff --git a/ground/openpilotgcs/src/plugins/coreplugin/coreimpl.cpp b/ground/openpilotgcs/src/plugins/coreplugin/coreimpl.cpp index f3e95a8cb..dd6c3d0bc 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/coreimpl.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/coreimpl.cpp @@ -183,6 +183,7 @@ void CoreImpl::updateContext() void CoreImpl::openFiles(const QStringList &arguments) { + Q_UNUSED(arguments) //m_mainwindow->openFiles(arguments); } diff --git a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp index 5926e6c98..25170092e 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp +++ b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.cpp @@ -290,13 +290,11 @@ void MainWindow::extensionsInitialized() if ( ! qs->allKeys().count() ){ QMessageBox msgBox; msgBox.setText(tr("No configuration file could be found.")); - msgBox.setInformativeText(tr("Do you want to load the default configuration?")); - msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - msgBox.setDefaultButton(QMessageBox::Yes); - if ( msgBox.exec() == QMessageBox::Yes ){ - qDebug() << "Load default config from resource /core/OpenPilotGCS.xml"; - qs = &defaultSettings; - } + msgBox.setInformativeText(tr("The default configuration will be loaded.")); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.exec(); + qDebug() << "Load default config from resource /core/OpenPilotGCS.xml"; + qs = &defaultSettings; } m_uavGadgetInstanceManager = new UAVGadgetInstanceManager(this); diff --git a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h index 585d4604a..d2f7b1977 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/mainwindow.h @@ -177,8 +177,8 @@ private: QList m_additionalContexts; QSettings *m_settings; QSettings *m_globalSettings; - bool m_dontSaveSettings; // In case of an Error or if we reset the settings, never save them. SettingsDatabase *m_settingsDatabase; + bool m_dontSaveSettings; // In case of an Error or if we reset the settings, never save them. ActionManagerPrivate *m_actionManager; MessageManager *m_messageManager; VariableManager *m_variableManager; diff --git a/ground/openpilotgcs/src/plugins/importexport/importexport.pro b/ground/openpilotgcs/src/plugins/importexport/importexport.pro index 0d5d2778d..3c9b6ba13 100644 --- a/ground/openpilotgcs/src/plugins/importexport/importexport.pro +++ b/ground/openpilotgcs/src/plugins/importexport/importexport.pro @@ -7,18 +7,9 @@ include(importexport_dependencies.pri) HEADERS += importexportplugin.h \ importexportgadgetwidget.h \ importexportdialog.h -HEADERS += importexportgadget.h -HEADERS += importexportgadgetfactory.h -HEADERS += importexportgadgetconfiguration.h -HEADERS += importexportgadgetoptionspage.h SOURCES += importexportplugin.cpp \ importexportgadgetwidget.cpp \ importexportdialog.cpp -SOURCES += importexportgadget.cpp -SOURCES += importexportgadgetfactory.cpp -SOURCES += importexportgadgetconfiguration.cpp -SOURCES += importexportgadgetoptionspage.cpp OTHER_FILES += ImportExportGadget.pluginspec -FORMS += importexportgadgetoptionspage.ui \ - importexportgadgetwidget.ui \ +FORMS += importexportgadgetwidget.ui \ importexportdialog.ui diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportdialog.cpp b/ground/openpilotgcs/src/plugins/importexport/importexportdialog.cpp index 74efb81e1..df38653f8 100644 --- a/ground/openpilotgcs/src/plugins/importexport/importexportdialog.cpp +++ b/ground/openpilotgcs/src/plugins/importexport/importexportdialog.cpp @@ -1,12 +1,11 @@ #include "importexportdialog.h" #include "ui_importexportdialog.h" -ImportExportDialog::ImportExportDialog( ImportExportGadgetConfiguration *config, QWidget *parent) : +ImportExportDialog::ImportExportDialog(QWidget *parent) : QDialog(parent), ui(new Ui::ImportExportDialog) { ui->setupUi(this); - ui->widget->loadConfiguration(config); setWindowTitle(tr("Import Export Settings")); connect( ui->widget, SIGNAL(done()), this, SLOT(close())); diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportdialog.h b/ground/openpilotgcs/src/plugins/importexport/importexportdialog.h index e93addd77..008d588d1 100644 --- a/ground/openpilotgcs/src/plugins/importexport/importexportdialog.h +++ b/ground/openpilotgcs/src/plugins/importexport/importexportdialog.h @@ -27,7 +27,6 @@ #define IMPORTEXPORTDIALOG_H #include -#include "importexportgadgetconfiguration.h" namespace Ui { class ImportExportDialog; @@ -38,7 +37,7 @@ class ImportExportDialog : public QDialog Q_OBJECT public: - explicit ImportExportDialog( ImportExportGadgetConfiguration *config, QWidget *parent = 0); + explicit ImportExportDialog(QWidget *parent = 0); ~ImportExportDialog(); protected: diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportdialog.ui b/ground/openpilotgcs/src/plugins/importexport/importexportdialog.ui index eca016fc4..3c0fca682 100644 --- a/ground/openpilotgcs/src/plugins/importexport/importexportdialog.ui +++ b/ground/openpilotgcs/src/plugins/importexport/importexportdialog.ui @@ -23,7 +23,7 @@ Qt::Horizontal - QDialogButtonBox::Cancel + QDialogButtonBox::Close diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetconfiguration.cpp b/ground/openpilotgcs/src/plugins/importexport/importexportgadgetconfiguration.cpp deleted file mode 100644 index 8e97c9bec..000000000 --- a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetconfiguration.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/** - ****************************************************************************** - * - * @file importexportgadgetconfiguration.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @see The GNU Public License (GPL) Version 3 - * @brief Configuration for Import/Export Plugin - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup importexportplugin - * @{ - * - *****************************************************************************/ -/* - * 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 "importexportgadgetconfiguration.h" - -static const QString VERSION = "1.0.1"; - -/** - * Loads a saved configuration or defaults if non exist. - * - */ -ImportExportGadgetConfiguration::ImportExportGadgetConfiguration(QString classId, QSettings* qSettings, UAVConfigInfo *configInfo, QObject *parent) : - IUAVGadgetConfiguration(classId, parent) -{ - if ( ! qSettings ) - return; - - if ( configInfo->version() == UAVConfigVersion() ) - configInfo->setVersion("1.0.0"); - - if ( !configInfo->standardVersionHandlingOK(VERSION)) - return; - - iniFile = qSettings->value("iniFile", "gcs.xml").toString(); -} - -/** - * Clones a configuration. - * - */ -IUAVGadgetConfiguration *ImportExportGadgetConfiguration::clone() -{ - ImportExportGadgetConfiguration *m = new ImportExportGadgetConfiguration(this->classId()); - m->iniFile = iniFile; - return m; -} - -/** - * Saves a configuration. - * - */ -void ImportExportGadgetConfiguration::saveConfig(QSettings* qSettings, Core::UAVConfigInfo *configInfo) const { - configInfo->setVersion(VERSION); - qSettings->setValue("iniFile", iniFile); -} - -/** - * @} - * @} - */ diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetconfiguration.h b/ground/openpilotgcs/src/plugins/importexport/importexportgadgetconfiguration.h deleted file mode 100644 index 21a87ff27..000000000 --- a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetconfiguration.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - ****************************************************************************** - * @file - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @see The GNU Public License (GPL) Version 3 - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup importexportplugin - * @{ - *****************************************************************************/ -/* - * 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 IMPORTEXPORTGADGETCONFIGURATION_H -#define IMPORTEXPORTGADGETCONFIGURATION_H - -#include -#include "importexport_global.h" - -using namespace Core; - -/* This is a generic bargraph dial - supporting one indicator. - */ -class IMPORTEXPORT_EXPORT ImportExportGadgetConfiguration : public IUAVGadgetConfiguration -{ - Q_OBJECT -public: - ImportExportGadgetConfiguration(QString classId, QSettings* qSettings = 0, UAVConfigInfo *configInfo = 0, QObject *parent = 0); - - //set dial configuration functions - void setIniFile(QString filename) { - iniFile = filename; - } - - //get dial configuration functions - QString getIniFile() const{ - return iniFile; - } - - void saveConfig(QSettings* settings, Core::UAVConfigInfo *configInfo) const; - IUAVGadgetConfiguration *clone(); - -private: - QString iniFile; -}; - -#endif // IMPORTEXPORTGADGETCONFIGURATION_H -/** - * @} - * @} - */ diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetfactory.cpp b/ground/openpilotgcs/src/plugins/importexport/importexportgadgetfactory.cpp deleted file mode 100644 index b9d93fde3..000000000 --- a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetfactory.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/** - ****************************************************************************** - * - * @file importexportgadgetfactory.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @see The GNU Public License (GPL) Version 3 - * @brief Factory for Import/Export Plugin - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup importexportplugin - * @{ - * - *****************************************************************************/ -/* - * 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 "importexportgadgetfactory.h" -#include "importexportgadgetwidget.h" -#include "importexportgadget.h" -#include "importexportgadgetconfiguration.h" -#include "importexportgadgetoptionspage.h" -#include - -ImportExportGadgetFactory::ImportExportGadgetFactory(QObject *parent) : - IUAVGadgetFactory(QString("ImportExportGadget"), - tr("Import/Export GCS Config"), - parent) -{ -} - -ImportExportGadgetFactory::~ImportExportGadgetFactory() -{ -} - -Core::IUAVGadget* ImportExportGadgetFactory::createGadget(QWidget *parent) -{ - ImportExportGadgetWidget* gadgetWidget = new ImportExportGadgetWidget(parent); - return new ImportExportGadget(QString("ImportExportGadget"), gadgetWidget, parent); -} - -IUAVGadgetConfiguration *ImportExportGadgetFactory::createConfiguration(QSettings* qSettings, UAVConfigInfo *configInfo) -{ - lastConfig = new ImportExportGadgetConfiguration(QString("ImportExportGadget"), qSettings, configInfo); - return lastConfig; -} - -IOptionsPage *ImportExportGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config) -{ - return new ImportExportGadgetOptionsPage(qobject_cast(config)); -} - -/** - * @} - * @} - */ diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetfactory.h b/ground/openpilotgcs/src/plugins/importexport/importexportgadgetfactory.h deleted file mode 100644 index ac1b56494..000000000 --- a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetfactory.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - ****************************************************************************** - * @file - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @see The GNU Public License (GPL) Version 3 - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup importexportplugin - * @{ - *****************************************************************************/ -/* - * 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 IMPORTEXPORTGADGETFACTORY_H_ -#define IMPORTEXPORTGADGETFACTORY_H_ - -#include -#include "importexportgadgetconfiguration.h" - -namespace Core -{ -class IUAVGadget; -class IUAVGadgetFactory; -} - -using namespace Core; - -class IMPORTEXPORT_EXPORT ImportExportGadgetFactory : public IUAVGadgetFactory -{ - Q_OBJECT -public: - ImportExportGadgetFactory(QObject *parent = 0); - ~ImportExportGadgetFactory(); - ImportExportGadgetConfiguration *getLastConfig(){ return lastConfig;} - - Core::IUAVGadget *createGadget(QWidget *parent); - IUAVGadgetConfiguration *createConfiguration(QSettings *qSettings, UAVConfigInfo *configInfo); - IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config); - -private: - ImportExportGadgetConfiguration *lastConfig; -}; - -#endif // IMPORTEXPORTGADGETFACTORY_H_ -/** - * @} - * @} - */ diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetoptionspage.cpp b/ground/openpilotgcs/src/plugins/importexport/importexportgadgetoptionspage.cpp deleted file mode 100644 index ade45bb5f..000000000 --- a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetoptionspage.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/** - ****************************************************************************** - * - * @file importexportgadgetoptionspage.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @see The GNU Public License (GPL) Version 3 - * @brief Option page for Import/Export Plugin - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup importexportplugin - * @{ - * - *****************************************************************************/ -/* - * 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 "importexportgadgetoptionspage.h" -#include "importexportgadgetconfiguration.h" -#include "ui_importexportgadgetoptionspage.h" - -#include -#include - -ImportExportGadgetOptionsPage::ImportExportGadgetOptionsPage(ImportExportGadgetConfiguration *config, QObject *parent) : - IOptionsPage(parent), - m_config(config) -{ -} - -//creates options page widget (uses the UI file) -QWidget *ImportExportGadgetOptionsPage::createPage(QWidget *parent) -{ - - options_page = new Ui::ImportExportGadgetOptionsPage(); - //main widget - QWidget *optionsPageWidget = new QWidget; - //main layout - options_page->setupUi(optionsPageWidget); - - // Restore the contents from the settings: - options_page->iniFile->setExpectedKind(Utils::PathChooser::File); - options_page->iniFile->setPromptDialogFilter(tr("INI file (*.ini);; XML file (*.xml)")); - options_page->iniFile->setPromptDialogTitle(tr("Choose configuration file")); - options_page->iniFile->setPath(m_config->getIniFile()); - - return optionsPageWidget; -} - -/** - * Called when the user presses apply or OK. - * - * Saves the current values - * - */ -void ImportExportGadgetOptionsPage::apply() -{ - m_config->setIniFile(options_page->iniFile->path()); -} - - -void ImportExportGadgetOptionsPage::finish() -{ - -} -/** - * @} - * @} - */ diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetoptionspage.h b/ground/openpilotgcs/src/plugins/importexport/importexportgadgetoptionspage.h deleted file mode 100644 index 41415dde4..000000000 --- a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetoptionspage.h +++ /dev/null @@ -1,74 +0,0 @@ -/** - ****************************************************************************** - * @file - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @see The GNU Public License (GPL) Version 3 - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup importexportplugin - * @{ - *****************************************************************************/ -/* - * 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 IMPORTEXPORTGADGETOPTIONSPAGE_H -#define IMPORTEXPORTGADGETOPTIONSPAGE_H - -#include "importexport_global.h" -#include "coreplugin/dialogs/ioptionspage.h" -#include -#include -#include -#include - -namespace Core -{ -class IUAVGadgetConfiguration; -} - -class ImportExportGadgetConfiguration; - -namespace Ui -{ -class ImportExportGadgetOptionsPage; -} - -using namespace Core; - -class IMPORTEXPORT_EXPORT ImportExportGadgetOptionsPage : public IOptionsPage -{ - Q_OBJECT -public: - explicit ImportExportGadgetOptionsPage(ImportExportGadgetConfiguration *config, QObject *parent = 0); - - QWidget *createPage(QWidget *parent); - void apply(); - void finish(); - -private: - Ui::ImportExportGadgetOptionsPage *options_page; - ImportExportGadgetConfiguration *m_config; - QFont font; - -private slots: - -}; - -#endif // IMPORTEXPORTGADGETOPTIONSPAGE_H -/** - * @} - * @} - */ diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetoptionspage.ui b/ground/openpilotgcs/src/plugins/importexport/importexportgadgetoptionspage.ui deleted file mode 100644 index 176d5dd6c..000000000 --- a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetoptionspage.ui +++ /dev/null @@ -1,103 +0,0 @@ - - - ImportExportGadgetOptionsPage - - - - 0 - 0 - 486 - 300 - - - - - 0 - 0 - - - - Form - - - - - -1 - -1 - 485 - 339 - - - - - QLayout::SetMinimumSize - - - 10 - - - 5 - - - 10 - - - 10 - - - - - 10 - - - QLayout::SetMaximumSize - - - 10 - - - - - Default Config File - - - - - - - - 0 - 0 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Utils::PathChooser - QWidget -

utils/pathchooser.h
- 1 - - - - - diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/importexport/importexportgadgetwidget.cpp index eda567bde..350e1a3ff 100644 --- a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/importexport/importexportgadgetwidget.cpp @@ -48,10 +48,9 @@ ImportExportGadgetWidget::ImportExportGadgetWidget(QWidget *parent) : setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); ui->setupUi(this); ui->configFile->setExpectedKind(Utils::PathChooser::File); - ui->configFile->setPromptDialogFilter(tr("INI file (*.ini);; XML file (*.xml)")); + ui->configFile->setPromptDialogFilter(tr("XML file (*.xml)")); ui->configFile->setPromptDialogTitle(tr("Choose configuration file")); - } ImportExportGadgetWidget::~ImportExportGadgetWidget() @@ -70,17 +69,22 @@ void ImportExportGadgetWidget::changeEvent(QEvent *e) break; } } -void ImportExportGadgetWidget::loadConfiguration(const ImportExportGadgetConfiguration* config) -{ - if ( !config ) - return; - - ui->configFile->setPath(config->getIniFile()); -} void ImportExportGadgetWidget::on_exportButton_clicked() { QString file = ui->configFile->path(); + if (file.isEmpty()) { + QMessageBox msgBox; + msgBox.setText(tr("Empty File name.")); + msgBox.setInformativeText(tr("Please choose an export file name.")); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.exec(); + return; + } + // Add a "XML" extension to the file in case it does not exist: + if (!file.endsWith(".xml")) + file.append(".xml"); + qDebug() << "Export pressed! Write to file " << QFileInfo(file).absoluteFilePath(); if ( QFileInfo(file).exists() ){ @@ -133,18 +137,7 @@ void ImportExportGadgetWidget::exportConfiguration(const QString& fileName) bool doAllGadgets = ui->checkBoxAllGadgets->isChecked(); bool doPlugins = ui->checkBoxPlugins->isChecked(); - QSettings::Format format; - if ( ui->radioButtonIniFormat->isChecked() ){ - format = QSettings::IniFormat; - } - else if ( ui->radioButtonXmlFormat->isChecked() ){ - format = XmlConfig::XmlSettingsFormat; - } - else { - qWarning() << "Program Error in ImportExportGadgetWidget::exportConfiguration: unknown format. Assume XML!"; - format = XmlConfig::XmlSettingsFormat; - } - + QSettings::Format format = XmlConfig::XmlSettingsFormat; QSettings qs(fileName, format); if (doGeneral) { @@ -193,19 +186,7 @@ void ImportExportGadgetWidget::importConfiguration(const QString& fileName) bool doAllGadgets = ui->checkBoxAllGadgets->isChecked(); bool doPlugins = ui->checkBoxPlugins->isChecked(); - QSettings::Format format; - if ( ui->radioButtonIniFormat->isChecked() ){ - format = QSettings::IniFormat; - } - else if ( ui->radioButtonXmlFormat->isChecked() ){ - format = XmlConfig::XmlSettingsFormat; - } - else { - qWarning() << "Program Error in ImportExportGadgetWidget::exportConfiguration: unknown format. Assume XML!"; - format = XmlConfig::XmlSettingsFormat; - } - - QSettings qs(fileName, format); + QSettings qs(fileName, XmlConfig::XmlSettingsFormat); if ( doAllGadgets ) { Core::ICore::instance()->uavGadgetInstanceManager()->readSettings(&qs); diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetwidget.h b/ground/openpilotgcs/src/plugins/importexport/importexportgadgetwidget.h index 37393678c..ced46a059 100644 --- a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/importexport/importexportgadgetwidget.h @@ -13,8 +13,8 @@ #include #include +#include "importexport_global.h" #include -#include "importexportgadgetconfiguration.h" namespace Ui { @@ -28,8 +28,6 @@ public: ImportExportGadgetWidget(QWidget *parent = 0); ~ImportExportGadgetWidget(); - void loadConfiguration(const ImportExportGadgetConfiguration* config); - signals: void done(); diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetwidget.ui b/ground/openpilotgcs/src/plugins/importexport/importexportgadgetwidget.ui index 2aba80711..c29461d5c 100644 --- a/ground/openpilotgcs/src/plugins/importexport/importexportgadgetwidget.ui +++ b/ground/openpilotgcs/src/plugins/importexport/importexportgadgetwidget.ui @@ -82,8 +82,50 @@
+ + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 32 + 32 + + + + + + + + :/core/images/helpicon.svg:/core/images/helpicon.svg + + + + 32 + 32 + + + + true + + + + + Export the GCS settings selected in the checkboxes above. + Export @@ -91,6 +133,9 @@ + + Import settings from the config file, only for the items checked above. + Import @@ -98,46 +143,16 @@ + + Resets your GCS configuration to its default configuration. + Reset Config - - - - Help - - - - - - - Format - - - - - - XML Format - - - true - - - - - - - INI Format - - - - - - @@ -148,6 +163,8 @@ 1 - + + + diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportplugin.cpp b/ground/openpilotgcs/src/plugins/importexport/importexportplugin.cpp index 44d2b82a1..d7fa31a54 100644 --- a/ground/openpilotgcs/src/plugins/importexport/importexportplugin.cpp +++ b/ground/openpilotgcs/src/plugins/importexport/importexportplugin.cpp @@ -4,7 +4,7 @@ * @file importexportplugin.cpp * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. * @see The GNU Public License (GPL) Version 3 - * @brief Import/Export Plugin + * @brief Import/Export Plugin for GCS Settings * @addtogroup GCSPlugins GCS Plugins * @{ * @defgroup importexportplugin @@ -28,7 +28,6 @@ */ #include "importexportplugin.h" -#include "importexportgadgetfactory.h" #include "importexportdialog.h" #include #include @@ -55,8 +54,6 @@ bool ImportExportPlugin::initialize(const QStringList& args, QString *errMsg) { Q_UNUSED(args); Q_UNUSED(errMsg); - mf = new ImportExportGadgetFactory(this); - addAutoReleasedObject(mf); // Add Menu entry Core::ActionManager* am = Core::ICore::instance()->actionManager(); @@ -66,7 +63,7 @@ bool ImportExportPlugin::initialize(const QStringList& args, QString *errMsg) "ImportExportPlugin.ImportExport", QList() << Core::Constants::C_GLOBAL_ID); - cmd->setDefaultKeySequence(QKeySequence("Ctrl+I")); + cmd->setDefaultKeySequence(QKeySequence("Ctrl+S")); cmd->action()->setText(tr("GCS Settings Import/Export...")); // ac->menu()->addSeparator(); @@ -82,7 +79,7 @@ bool ImportExportPlugin::initialize(const QStringList& args, QString *errMsg) void ImportExportPlugin::importExport() { - ImportExportDialog(mf->getLastConfig()).exec(); + ImportExportDialog().exec(); } void ImportExportPlugin::extensionsInitialized() diff --git a/ground/openpilotgcs/src/plugins/importexport/importexportplugin.h b/ground/openpilotgcs/src/plugins/importexport/importexportplugin.h index 91b3ed901..7070ce56c 100644 --- a/ground/openpilotgcs/src/plugins/importexport/importexportplugin.h +++ b/ground/openpilotgcs/src/plugins/importexport/importexportplugin.h @@ -30,8 +30,6 @@ #include #include "importexport_global.h" -class ImportExportGadgetFactory; - class IMPORTEXPORT_EXPORT ImportExportPlugin : public ExtensionSystem::IPlugin { Q_OBJECT @@ -44,7 +42,6 @@ public: bool initialize(const QStringList & arguments, QString * errorString); void shutdown(); private: - ImportExportGadgetFactory *mf; private slots: void importExport(); diff --git a/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetoptionspage.ui b/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetoptionspage.ui index 1d94b3cf4..9bf5c93e0 100644 --- a/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetoptionspage.ui +++ b/ground/openpilotgcs/src/plugins/lineardial/lineardialgadgetoptionspage.ui @@ -1,546 +1,507 @@ - - - LineardialGadgetOptionsPage - - - - 0 - 0 - 540 - 347 - - - - - 0 - 0 - - - - Form - - - - - -1 - -1 - 533 - 321 - - - - - QLayout::SetMinimumSize - - - 10 - - - 5 - - - 10 - - - 10 - - - - - - - Use OpenGL - - - true - - - - - - - - - Qt::Horizontal - - - - - - - 10 - - - QLayout::SetMaximumSize - - - 10 - - - - - Dial SVG: - - - - - - - - 0 - 0 - - - - - - - - - - - - - 0 - 0 - - - - Whole range: - - - - - - - Min: - - - - - - - - 0 - 0 - - - - 3 - - - -99999.000000000000000 - - - 99999.990000000005239 - - - - - - - Max: - - - - - - - - 0 - 0 - - - - 3 - - - -99999.000000000000000 - - - 99999.990000000005239 - - - - - - - - - Qt::Horizontal - - - - - - - - - - 0 - 0 - - - - Green: - - - - - - - Min: - - - - - - - - 0 - 0 - - - - 3 - - - -99999.000000000000000 - - - 99999.990000000005239 - - - - - - - Max: - - - - - - - - 0 - 0 - - - - 3 - - - -99999.000000000000000 - - - 99999.990000000005239 - - - - - - - - - Qt::Horizontal - - - - - - - - - - 0 - 0 - - - - Yellow: - - - - - - - Min: - - - - - - - - 0 - 0 - - - - 3 - - - -99999.000000000000000 - - - 99999.990000000005239 - - - - - - - Max: - - - - - - - - 0 - 0 - - - - 3 - - - -99999.000000000000000 - - - 99999.990000000005239 - - - - - - - - - Qt::Horizontal - - - - - - - - - - 0 - 0 - - - - Red: - - - - - - - Min: - - - - - - - - 0 - 0 - - - - 3 - - - -99999.000000000000000 - - - 99999.990000000005239 - - - - - - - Max: - - - - - - - - 0 - 0 - - - - 3 - - - -99999.000000000000000 - - - 99999.990000000005239 - - - - - - - - - - - - 0 - 0 - - - - Input: - - - - - - - ObjectName - - - - - - - - 0 - 0 - - - - - - - - ObjectField - - - - - - - - 0 - 0 - - - - - - - - - - 0 - - - - - - 0 - 0 - - - - Dial font: - - - - - - - Select... - - - - - - - Decimal places: - - - - - - - 99 - - - - - - - Factor: - - - - - - - 6 - - - -10000.000000000000000 - - - 100000.000000000000000 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Utils::PathChooser - QWidget -
utils/pathchooser.h
- 1 -
-
- - -
+ + + LineardialGadgetOptionsPage + + + + 0 + 0 + 540 + 347 + + + + + 0 + 0 + + + + Form + + + + + + + + Use OpenGL + + + true + + + + + + + + + Qt::Horizontal + + + + + + + 10 + + + QLayout::SetMaximumSize + + + 10 + + + + + Dial SVG: + + + + + + + + 0 + 0 + + + + + + + + + + + + + 0 + 0 + + + + Whole range: + + + + + + + Min: + + + + + + + + 0 + 0 + + + + 3 + + + -99999.000000000000000 + + + 99999.990000000005239 + + + + + + + Max: + + + + + + + + 0 + 0 + + + + 3 + + + -99999.000000000000000 + + + 99999.990000000005239 + + + + + + + + + Qt::Horizontal + + + + + + + + + + 0 + 0 + + + + Green: + + + + + + + Min: + + + + + + + + 0 + 0 + + + + 3 + + + -99999.000000000000000 + + + 99999.990000000005239 + + + + + + + Max: + + + + + + + + 0 + 0 + + + + 3 + + + -99999.000000000000000 + + + 99999.990000000005239 + + + + + + + + + + + + 0 + 0 + + + + Yellow: + + + + + + + Min: + + + + + + + + 0 + 0 + + + + 3 + + + -99999.000000000000000 + + + 99999.990000000005239 + + + + + + + Max: + + + + + + + + 0 + 0 + + + + 3 + + + -99999.000000000000000 + + + 99999.990000000005239 + + + + + + + + + + + + 0 + 0 + + + + Red: + + + + + + + Min: + + + + + + + + 0 + 0 + + + + 3 + + + -99999.000000000000000 + + + 99999.990000000005239 + + + + + + + Max: + + + + + + + + 0 + 0 + + + + 3 + + + -99999.000000000000000 + + + 99999.990000000005239 + + + + + + + + + + + + 0 + 0 + + + + Input: + + + + + + + ObjectName + + + + + + + + 0 + 0 + + + + + + + + ObjectField + + + + + + + + 0 + 0 + + + + + + + + + + 0 + + + + + + 0 + 0 + + + + Dial font: + + + + + + + Select... + + + + + + + Decimal places: + + + + + + + 99 + + + + + + + Factor: + + + + + + + 6 + + + -10000.000000000000000 + + + 100000.000000000000000 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 +
+
+ + +
diff --git a/ground/openpilotgcs/src/plugins/pfd/pfdgadgetoptionspage.ui b/ground/openpilotgcs/src/plugins/pfd/pfdgadgetoptionspage.ui index 4086d1a5a..f9a2808b3 100644 --- a/ground/openpilotgcs/src/plugins/pfd/pfdgadgetoptionspage.ui +++ b/ground/openpilotgcs/src/plugins/pfd/pfdgadgetoptionspage.ui @@ -7,7 +7,7 @@ 0 0 529 - 346 + 271 @@ -19,131 +19,99 @@ Form - - - - -1 - -1 - 504 - 331 - - - - - QLayout::SetMinimumSize - - - 10 - - - 5 - - - 10 - - - 10 - - - - - 10 - - - QLayout::SetMaximumSize - - - 10 - - - - - PFD SVG: - - - - - - - - 0 - 0 - - - - - - - - - - Qt::Horizontal - - - - - - - - - true - - - Use OpenGL for rendering - - - true - - - - - - - High Quality text (OpenGL) - - - - - - - - - - - Smooth updates - - - true - - - - - - - - - Qt::Vertical - - - QSizePolicy::Minimum - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - - - + + + + + 10 + + + QLayout::SetMaximumSize + + + 10 + + + + + PFD SVG: + + + + + + + + 0 + 0 + + + + + + + + + + Qt::Horizontal + + + + + + + + + true + + + Use OpenGL for rendering + + + true + + + + + + + High Quality text (OpenGL) + + + + + + + + + + + Smooth updates + + + true + + + + + + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 20 + 40 + + + + + diff --git a/ground/openpilotgcs/src/plugins/scope/scopegadgetoptionspage.cpp b/ground/openpilotgcs/src/plugins/scope/scopegadgetoptionspage.cpp index 6dc549ba1..e44ccb08f 100644 --- a/ground/openpilotgcs/src/plugins/scope/scopegadgetoptionspage.cpp +++ b/ground/openpilotgcs/src/plugins/scope/scopegadgetoptionspage.cpp @@ -132,7 +132,7 @@ QWidget* ScopeGadgetOptionsPage::createPage(QWidget *parent) void ScopeGadgetOptionsPage::on_btnColor_clicked() { - QColor color = QColorDialog::getColor( QColor(options_page->btnColor->text()), options_page->widget); + QColor color = QColorDialog::getColor( QColor(options_page->btnColor->text())); if (color.isValid()) { setButtonColor(color); } diff --git a/ground/openpilotgcs/src/plugins/scope/scopegadgetoptionspage.ui b/ground/openpilotgcs/src/plugins/scope/scopegadgetoptionspage.ui index 4ba44b242..2aaee1942 100644 --- a/ground/openpilotgcs/src/plugins/scope/scopegadgetoptionspage.ui +++ b/ground/openpilotgcs/src/plugins/scope/scopegadgetoptionspage.ui @@ -1,329 +1,315 @@ - - - ScopeGadgetOptionsPage - - - - 0 - 0 - 550 - 290 - - - - Form - - - - - 10 - 10 - 541 - 271 - - - - - - 0 - 0 - 531 - 272 - - - - - 3 - - - - - QLayout::SetDefaultConstraint - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - - Bitstream Charter - 75 - true - - - - X-Axis - - - - - - - Plot Type: - - - - - - - - - - Data Size: - - - - - - - seconds - - - 5000 - - - 30 - - - 300 - - - - - - - Update Interval: - - - - - - - ms - - - 10 - - - 30000 - - - 500 - - - 1000 - - - - - - - - Bitstream Charter - 75 - true - - - - Plot curves - - - - - - - UAVObject: - - - - - - - - - - UAVField: - - - - - - - - - - Color: - - - - - - - Choose - - - - - - - Scale: - - - - - - - false - - - - - - - - - QLayout::SetFixedSize - - - - - Qt::Vertical - - - - 20 - 100 - - - - - - - - Add a new curve to the scope, or update it if the UAVObject and UAVField is the same. - - - Add -Update - - - - - - - Remove the curve from the scope. - - - Remove - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 15 - - - - - - - - - - - - Qt::Vertical - - - - 0 - 200 - - - - - - - - QAbstractItemView::SelectItems - - - 100 - - - - - - - - - - - - - - - - - Log data to csv file - - - - - - - New file on connect - - - - - - - - - Logging path - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - Utils::PathChooser - QWidget -
utils/pathchooser.h
- 1 -
-
- - -
+ + + ScopeGadgetOptionsPage + + + + 0 + 0 + 550 + 405 + + + + Form + + + + + + QLayout::SetDefaultConstraint + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + + Bitstream Charter + 75 + true + + + + X-Axis + + + + + + + Plot Type: + + + + + + + + + + Data Size: + + + + + + + seconds + + + 5000 + + + 30 + + + 300 + + + + + + + Update Interval: + + + + + + + ms + + + 10 + + + 30000 + + + 500 + + + 1000 + + + + + + + + Bitstream Charter + 75 + true + + + + Plot curves + + + + + + + UAVObject: + + + + + + + + + + UAVField: + + + + + + + + + + Color: + + + + + + + Choose + + + + + + + Scale: + + + + + + + false + + + + + + + + + QLayout::SetFixedSize + + + + + Qt::Vertical + + + + 20 + 100 + + + + + + + + Add a new curve to the scope, or update it if the UAVObject and UAVField is the same. + + + Add +Update + + + + + + + Remove the curve from the scope. + + + Remove + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 15 + + + + + + + + + + + + Qt::Vertical + + + + 0 + 200 + + + + + + + + QAbstractItemView::SelectItems + + + 100 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Log data to csv file + + + + + + + New file on connect + + + + + + + + + Logging path + + + + + + + + 0 + 0 + + + + + + + + + + + Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 +
+
+ + +
diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp index 9bfa9f24e..e86d4794b 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.cpp @@ -41,6 +41,11 @@ UAVObjectUtilManager::UAVObjectUtilManager() { mutex = new QMutex(QMutex::Recursive); + saveState = IDLE; + failureTimer.stop(); + failureTimer.setSingleShot(true); + failureTimer.setInterval(1000); + connect(&failureTimer, SIGNAL(timeout()),this,SLOT(objectPersistenceOperationFailed())); } UAVObjectUtilManager::~UAVObjectUtilManager() @@ -58,64 +63,154 @@ UAVObjectUtilManager::~UAVObjectUtilManager() } } + +UAVObjectManager* UAVObjectUtilManager::getObjectManager() { + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + UAVObjectManager * objMngr = pm->getObject(); + Q_ASSERT(objMngr); + return objMngr; +} + + // ****************************** // SD card saving +// +/* + Add a new object to save in the queue + */ void UAVObjectUtilManager::saveObjectToSD(UAVObject *obj) { - QMutexLocker locker(mutex); + // Add to queue + queue.enqueue(obj); + qDebug() << "Enqueue object: " << obj->getName(); - if (!obj) return; - // Add to queue - queue.enqueue(obj); + // If queue length is one, then start sending (call sendNextObject) + // Otherwise, do nothing, it's sending anyway + if (queue.length()==1) + saveNextObject(); + - // If queue length is one, then start sending (call sendNextObject) - // Otherwise, do nothing, it's sending anyway - if (queue.length() <= 1) - saveNextObject(); } void UAVObjectUtilManager::saveNextObject() { - if (queue.isEmpty()) return; + if ( queue.isEmpty() ) + { + return; + } - // Get next object from the queue - UAVObject *obj = queue.head(); - if (!obj) return; + Q_ASSERT(saveState == IDLE); - ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - if (!pm) return; + // Get next object from the queue + UAVObject* obj = queue.head(); + qDebug() << "Request board to save object " << obj->getName(); - UAVObjectManager *om = pm->getObject(); - if (!om) return; - - ObjectPersistence *objper = dynamic_cast(om->getObject(ObjectPersistence::NAME)); - connect(objper, SIGNAL(transactionCompleted(UAVObject *, bool)), this, SLOT(transactionCompleted(UAVObject *, bool))); - - ObjectPersistence::DataFields data; - data.Operation = ObjectPersistence::OPERATION_SAVE; - data.Selection = ObjectPersistence::SELECTION_SINGLEOBJECT; - data.ObjectID = obj->getObjID(); - data.InstanceID = obj->getInstID(); - objper->setData(data); - objper->updated(); + ObjectPersistence* objper = dynamic_cast( getObjectManager()->getObject(ObjectPersistence::NAME) ); + connect(objper, SIGNAL(transactionCompleted(UAVObject*,bool)), this, SLOT(objectPersistenceTransactionCompleted(UAVObject*,bool))); + connect(objper, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(objectPersistenceUpdated(UAVObject *))); + saveState = AWAITING_ACK; + if (obj != NULL) + { + ObjectPersistence::DataFields data; + data.Operation = ObjectPersistence::OPERATION_SAVE; + data.Selection = ObjectPersistence::SELECTION_SINGLEOBJECT; + data.ObjectID = obj->getObjID(); + data.InstanceID = obj->getInstID(); + objper->setData(data); + objper->updated(); + } + // Now: we are going to get two "objectUpdated" messages (one coming from GCS, one coming from Flight, which + // will confirm the object was properly received by both sides) and then one "transactionCompleted" indicating + // that the Flight side did not only receive the object but it did receive it without error. Last we will get + // a last "objectUpdated" message coming from flight side, where we'll get the results of the objectPersistence + // operation we asked for (saved, other). } -void UAVObjectUtilManager::transactionCompleted(UAVObject *obj, bool success) +/** + * @brief Process the transactionCompleted message from Telemetry indicating request sent successfully + * @param[in] The object just transsacted. Must be ObjectPersistance + * @param[in] success Indicates that the transaction did not time out + * + * After a failed transaction (usually timeout) resends the save request. After a succesful + * transaction will then wait for a save completed update from the autopilot. + */ +void UAVObjectUtilManager::objectPersistenceTransactionCompleted(UAVObject* obj, bool success) { - Q_UNUSED(success); - - QMutexLocker locker(mutex); - - if (!obj) return; - - // Disconnect from sending object - obj->disconnect(this); - queue.dequeue(); // We can now remove the object, it's done. - saveNextObject(); + if(success) { + Q_ASSERT(obj->getName().compare("ObjectPersistence") == 0); + Q_ASSERT(saveState == AWAITING_ACK); + // Two things can happen: + // Either the Object Save Request did actually go through, and then we should get in + // "AWAITING_COMPLETED" mode, or the Object Save Request did _not_ go through, for example + // because the object does not exist and then we will never get a subsequent update. + // For this reason, we will arm a 1 second timer to make provision for this and not block + // the queue: + saveState = AWAITING_COMPLETED; + disconnect(obj, SIGNAL(transactionCompleted(UAVObject*,bool)), this, SLOT(objectPersistenceTransactionCompleted(UAVObject*,bool))); + failureTimer.start(1000); // Create a timeout + } else { + // Can be caused by timeout errors on sending. Forget it and send next. + qDebug() << "objectPersistenceTranscationCompleted (error)"; + UAVObject *obj = getObjectManager()->getObject(ObjectPersistence::NAME); + obj->disconnect(this); + queue.dequeue(); // We can now remove the object, it failed anyway. + saveState = IDLE; + emit saveCompleted(obj->getField("ObjectID")->getValue().toInt(), false); + saveNextObject(); + } } +/** + * @brief Object persistence operation failed, i.e. we never got an update + * from the board saying "completed". + */ +void UAVObjectUtilManager::objectPersistenceOperationFailed() +{ + qDebug() << "objectPersistenceOperationFailed"; + if(saveState == AWAITING_COMPLETED) { + //TODO: some warning that this operation failed somehow + // We have to disconnect the object persistence 'updated' signal + // and ask to save the next object: + UAVObject *obj = getObjectManager()->getObject(ObjectPersistence::NAME); + obj->disconnect(this); + queue.dequeue(); // We can now remove the object, it failed anyway. + saveState = IDLE; + emit saveCompleted(obj->getField("ObjectID")->getValue().toInt(), false); + saveNextObject(); + } +} + + + +/** + * @brief Process the ObjectPersistence updated message to confirm the right object saved + * then requests next object be saved. + * @param[in] The object just received. Must be ObjectPersistance + */ +void UAVObjectUtilManager::objectPersistenceUpdated(UAVObject * obj) +{ + qDebug() << "objectPersistenceUpdated: " << obj->getField("Operation")->getValue().toString(); + Q_ASSERT(obj->getName().compare("ObjectPersistence") == 0); + if(saveState == AWAITING_COMPLETED) { + failureTimer.stop(); + // Check flight is saying it completed. This is the only thing flight should do to trigger an update. + Q_ASSERT( obj->getField("Operation")->getValue().toString().compare(QString("Completed")) == 0 ); + + // Check right object saved + UAVObject* savingObj = queue.head(); + Q_ASSERT( obj->getField("ObjectID")->getValue() == savingObj->getObjID() ); + + obj->disconnect(this); + queue.dequeue(); // We can now remove the object, it's done. + saveState = IDLE; + emit saveCompleted(obj->getField("ObjectID")->getValue().toInt(), true); + saveNextObject(); + } +} + + /** * Get the UAV Board model, for anyone interested. Return format is: * (Board Type << 8) + BoardRevision. diff --git a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h index 5d6afbfa2..de61068ca 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h +++ b/ground/openpilotgcs/src/plugins/uavobjectutil/uavobjectutilmanager.h @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -63,17 +64,25 @@ public: int getBoardModel(); QByteArray getBoardCPUSerial(); QString getBoardDescription(); + UAVObjectManager* getObjectManager(); + void saveObjectToSD(UAVObject *obj); + +signals: + void saveCompleted(int objectID, bool status); private: QMutex *mutex; - QQueue queue; - + enum {IDLE, AWAITING_ACK, AWAITING_COMPLETED} saveState; void saveNextObject(); - void saveObjectToSD(UAVObject *obj); + QTimer failureTimer; private slots: - void transactionCompleted(UAVObject *obj, bool success); + //void transactionCompleted(UAVObject *obj, bool success); + void objectPersistenceTransactionCompleted(UAVObject* obj, bool success); + void objectPersistenceUpdated(UAVObject * obj); + void objectPersistenceOperationFailed(); + }; diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.cpp b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.cpp new file mode 100644 index 000000000..a7bf6f367 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.cpp @@ -0,0 +1,137 @@ +/** + ****************************************************************************** + * + * @file importsummary.cpp + * @author (C) 2011 The OpenPilot Team, http://www.openpilot.org + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup UAVSettingsImportExport UAVSettings Import/Export Plugin + * @{ + * @brief UAVSettings Import/Export Plugin + *****************************************************************************/ +/* + * 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 "importsummary.h" + +ImportSummaryDialog::ImportSummaryDialog( QWidget *parent) : + QDialog(parent), + ui(new Ui::ImportSummaryDialog) +{ + ui->setupUi(this); + setWindowTitle(tr("Import Summary")); + + ui->importSummaryList->setColumnCount(3); + ui->importSummaryList->setRowCount(0); + QStringList header; + header.append("Save"); + header.append("Name"); + header.append("Status"); + ui->importSummaryList->setHorizontalHeaderLabels(header); + ui->progressBar->setValue(0); + + connect( ui->closeButton, SIGNAL(clicked()), this, SLOT(close())); + connect(ui->saveToFlash, SIGNAL(clicked()), this, SLOT(doTheSaving())); + + // Connect the help button + connect(ui->helpButton, SIGNAL(clicked()), this, SLOT(openHelp())); + +} + +ImportSummaryDialog::~ImportSummaryDialog() +{ + delete ui; +} + +/* + Open the right page on the wiki + */ +void ImportSummaryDialog::openHelp() +{ + QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/display/Doc/UAV+Settings+import-export", QUrl::StrictMode) ); +} + +/* + Adds a new line about a UAVObject along with its status + (whether it got saved OK or not) + */ +void ImportSummaryDialog::addLine(QString uavObjectName, QString text, bool status) +{ + ui->importSummaryList->setRowCount(ui->importSummaryList->rowCount()+1); + int row = ui->importSummaryList->rowCount()-1; + ui->progressBar->setMaximum(row); + ui->importSummaryList->setCellWidget(row,0,new QCheckBox(ui->importSummaryList)); + QTableWidgetItem *objName = new QTableWidgetItem(uavObjectName); + ui->importSummaryList->setItem(row, 1, objName); + QCheckBox *box = dynamic_cast(ui->importSummaryList->cellWidget(row,0)); + ui->importSummaryList->setItem(row,2,new QTableWidgetItem(text)); + if (status) { + box->setChecked(true); + } else { + box->setChecked(false); + box->setEnabled(false); + } + this->repaint(); + this->showEvent(NULL); +} + +/* + Saves every checked UAVObjet in the list to Flash + */ +void ImportSummaryDialog::doTheSaving() +{ + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + UAVObjectManager *objManager = pm->getObject(); + UAVObjectUtilManager *utilManager = pm->getObject(); + connect(utilManager, SIGNAL(saveCompleted(int,bool)), this, SLOT(updateSaveCompletion())); + + for(int i=0; i < ui->importSummaryList->rowCount(); i++) { + QString uavObjectName = ui->importSummaryList->item(i,1)->text(); + QCheckBox *box = dynamic_cast(ui->importSummaryList->cellWidget(i,0)); + if (box->isChecked()) { + UAVObject* obj = objManager->getObject(uavObjectName); + utilManager->saveObjectToSD(obj); + this->repaint(); + } + } +} + + +void ImportSummaryDialog::updateSaveCompletion() +{ + ui->progressBar->setValue(ui->progressBar->value()+1); +} + +void ImportSummaryDialog::changeEvent(QEvent *e) +{ + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + +void ImportSummaryDialog::showEvent(QShowEvent *event) +{ + Q_UNUSED(event) + ui->importSummaryList->resizeColumnsToContents(); + int width = ui->importSummaryList->width()-(ui->importSummaryList->columnWidth(0)+ + ui->importSummaryList->columnWidth(2)); + ui->importSummaryList->setColumnWidth(1,width-15); +} + diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.h b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.h new file mode 100644 index 000000000..ab88eb835 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummary.h @@ -0,0 +1,71 @@ +/** + ****************************************************************************** + * + * @file importsummary.h + * @author (C) 2011 The OpenPilot Team, http://www.openpilot.org + * @addtogroup GCSPlugins GCS Plugins + * @{ + * @addtogroup UAVSettingsImportExport UAVSettings Import/Export Plugin + * @{ + * @brief UAVSettings Import/Export Plugin + *****************************************************************************/ +/* + * 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 IMPORTSUMMARY_H +#define IMPORTSUMMARY_H + +#include +#include +#include +#include +#include "ui_importsummarydialog.h" +#include "uavdataobject.h" +#include "uavobjectmanager.h" +#include "extensionsystem/pluginmanager.h" +#include "uavobjectutil/uavobjectutilmanager.h" + + + +namespace Ui { + class ImportSummaryDialog; +} + +class ImportSummaryDialog : public QDialog +{ + Q_OBJECT + +public: + ImportSummaryDialog(QWidget *parent=0); + ~ImportSummaryDialog(); + void addLine(QString objectName, QString text, bool status); + +protected: + void showEvent(QShowEvent *event); + void changeEvent(QEvent *e); + +private: + Ui::ImportSummaryDialog *ui; + +public slots: + void updateSaveCompletion(); + +private slots: + void doTheSaving(); + void openHelp(); + +}; + +#endif // IMPORTSUMMARY_H diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummarydialog.ui b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummarydialog.ui new file mode 100644 index 000000000..7c7212eb0 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/importsummarydialog.ui @@ -0,0 +1,126 @@ + + + ImportSummaryDialog + + + + 0 + 0 + 400 + 377 + + + + Dialog + + + true + + + + + + UAV Settings import summary + + + + + + + Qt::ScrollBarAlwaysOff + + + true + + + 10 + + + true + + + false + + + false + + + + + + + 24 + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 32 + 32 + + + + + + + + :/core/images/helpicon.svg:/core/images/helpicon.svg + + + + 32 + 32 + + + + true + + + + + + + Save all settings checked above to persistent board storage, +then close the dialog. + + + Save to Board Flash/SD + + + + + + + Close this dialog without saving to persistent storage + + + Close + + + + + + + + + + + + diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.cpp b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.cpp index 7bd6b3e5b..f3c48c969 100644 --- a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.cpp +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.cpp @@ -25,17 +25,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* - * TODO: - * - write import functions - * - split formats into different files/classes - * - better error handling (not a lot of QMessageBoxes) - */ - #include "uavsettingsimportexport.h" #include #include +#include +#include // for menu item #include @@ -74,20 +69,22 @@ bool UAVSettingsImportExportPlugin::initialize(const QStringList& args, QString Core::ActionManager* am = Core::ICore::instance()->actionManager(); Core::ActionContainer* ac = am->actionContainer(Core::Constants::M_FILE); Core::Command* cmd = am->registerAction(new QAction(this), - "UAVSettingsImportExportPlugin.UAVSettingsImportExport", + "UAVSettingsImportExportPlugin.UAVSettingsExport", QList() << Core::Constants::C_GLOBAL_ID); - cmd->setDefaultKeySequence(QKeySequence("Ctrl+E")); + cmd->setDefaultKeySequence(QKeySequence("Ctrl+E")); + cmd->action()->setText(tr("Export UAV Settings...")); + ac->addAction(cmd, Core::Constants::G_FILE_SAVE); + connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(exportUAVSettings())); -// cmd->action()->setText(tr("UAV Settings Import/Export...")); - cmd->action()->setText(tr("UAV Settings Export...")); - -// ac->menu()->addSeparator(); -// ac->appendGroup("ImportExport"); -// ac->addAction(cmd, "ImportExport"); - ac->addAction(cmd, Core::Constants::G_FILE_SAVE); - - connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(importExport())); + cmd = am->registerAction(new QAction(this), + "UAVSettingsImportExportPlugin.UAVSettingsImport", + QList() << + Core::Constants::C_GLOBAL_ID); + cmd->setDefaultKeySequence(QKeySequence("Ctrl+I")); + cmd->action()->setText(tr("Import UAV Settings...")); + ac->addAction(cmd, Core::Constants::G_FILE_SAVE); + connect(cmd->action(), SIGNAL(triggered(bool)), this, SLOT(importUAVSettings())); return true; } @@ -97,40 +94,129 @@ void UAVSettingsImportExportPlugin::extensionsInitialized() // Do nothing } -// Slot called by the menu manager on user action -// TODO: import function is not implemented yet -void UAVSettingsImportExportPlugin::importExport() -{ - // available formats - enum { UNDEF, UAV, XML, INI } fileFormat = UNDEF; - // ask for file name and export format +// Slot called by the menu manager on user action +void UAVSettingsImportExportPlugin::importUAVSettings() +{ + // ask for file name QString fileName; - QString filters = tr("UAV Settings files (*.uav)") - + ";;" + tr("Simple XML files (*.xml)") - + ";;" + tr("INI files (*.ini)"); + QString filters = tr("UAVSettings XML files (*.uav);; XML files (*.xml)"); + fileName = QFileDialog::getOpenFileName(0, tr("Import UAV Settings"), "", filters); + if (fileName.isEmpty()) { + return; + } + + // Now open the file + QFile file(fileName); + QDomDocument doc("UAVSettings"); + file.open(QFile::ReadOnly|QFile::Text); + if (!doc.setContent(file.readAll())) { + QMessageBox msgBox; + msgBox.setText(tr("File Parsing Failed.")); + msgBox.setInformativeText(tr("This file is not a correct XML file")); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.exec(); + return; + } + file.close(); + + QDomElement root = doc.documentElement(); + if (root.tagName() != "settings") { + QMessageBox msgBox; + msgBox.setText(tr("Wrong file contents.")); + msgBox.setInformativeText(tr("This file is not a correct UAVSettings file")); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.exec(); + return; + } + + // We are now ok: setup the import summary dialog & update it as we + // go along. + ImportSummaryDialog swui; + + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + UAVObjectManager *objManager = pm->getObject(); + swui.show(); + + QDomNode node = root.firstChild(); + while (!node.isNull()) { + QDomElement e = node.toElement(); + if (e.tagName() == "object") { + // - Read each object + QString uavObjectName = e.attribute("name"); + uint uavObjectID = e.attribute("id").toUInt(NULL,16); + + // Sanity Check: + UAVObject* obj = objManager->getObject(uavObjectName); + if (obj == NULL) { + // This object is unknown! + qDebug() << "Object unknown:" << uavObjectName << uavObjectID; + swui.addLine(uavObjectName, "Error (Object unknown)", false); + + } else { + // - Update each field + // - Issue and "updated" command + bool error=false; + QDomNode field = node.firstChild(); + while(!field.isNull()) { + QDomElement f = field.toElement(); + if (f.tagName() == "field") { + UAVObjectField *uavfield = obj->getField(f.attribute("name")); + if (uavfield) { + QStringList list = f.attribute("values").split(","); + if (list.length() == 1) { + uavfield->setValue(f.attribute("values")); + } else { + // This is an enum: + int i=0; + QStringList list = f.attribute("values").split(","); + foreach (QString element, list) { + uavfield->setValue(element,i++); + } + } + error = false; + } else { + error = true; + } + } + field = field.nextSibling(); + } + obj->updated(); + if (error) { + swui.addLine(uavObjectName, "Warning (Object field unknown)", true); + } else if (uavObjectID != obj->getObjID()) { + qDebug() << "Mismatch for Object " << uavObjectName << uavObjectID << " - " << obj->getObjID(); + swui.addLine(uavObjectName, "Warning (ObjectID mismatch)", true); + } else + swui.addLine(uavObjectName, "OK", true); + } + } + node = node.nextSibling(); + } + swui.exec(); + + + +} + +// Slot called by the menu manager on user action +void UAVSettingsImportExportPlugin::exportUAVSettings() +{ + // ask for file name + QString fileName; + QString filters = tr("UAVSettings XML files (*.uav)"); fileName = QFileDialog::getSaveFileName(0, tr("Save UAV Settings File As"), "", filters); if (fileName.isEmpty()) { return; } - // check export file format - QFileInfo fileInfo(fileName); - QString fileType = fileInfo.suffix().toLower(); - - if (fileType == "uav") { - fileFormat = UAV; - } else if (fileType == "xml") { - fileFormat = XML; - } else if (fileType == "ini") { - fileFormat = INI; - } else { - QMessageBox::critical(0, - tr("UAV Settings Export"), - tr("Unsupported export file format: ") + fileType, - QMessageBox::Ok); - return; + bool fullExport = false; + // If the filename ends with .xml, we will do a full export, otherwise, a simple export + if (fileName.endsWith(".xml")) { + fullExport = true; + } else if (!fileName.endsWith(".uav")) { + fileName.append(".uav"); } // generate an XML first (used for all export formats as a formatted data source) @@ -152,7 +238,7 @@ void UAVSettingsImportExportPlugin::importExport() QDomElement o = doc.createElement("object"); o.setAttribute("name", obj->getName()); o.setAttribute("id", QString("0x")+ QString().setNum(obj->getObjID(),16).toUpper()); - if (fileFormat == UAV) { + if (fullExport) { QDomElement d = doc.createElement("description"); QDomText t = doc.createTextNode(obj->getDescription().remove("@Ref ", Qt::CaseInsensitive)); d.appendChild(t); @@ -175,7 +261,7 @@ void UAVSettingsImportExportPlugin::importExport() f.setAttribute("name", field->getName()); f.setAttribute("values", vals); - if (fileFormat == UAV) { + if (fullExport) { f.setAttribute("type", field->getTypeAsString()); f.setAttribute("units", field->getUnits()); f.setAttribute("elements", nelem); @@ -189,48 +275,23 @@ void UAVSettingsImportExportPlugin::importExport() } } } - // save file - if ((fileFormat == UAV) || (fileFormat == XML)) { - QFile file(fileName); - if (file.open(QIODevice::WriteOnly) && - (file.write(doc.toString(4).toAscii()) != -1)) { - file.close(); - } else { - QMessageBox::critical(0, - tr("UAV Settings Export"), - tr("Unable to save settings: ") + fileName, - QMessageBox::Ok); - return; - } - } else if (fileFormat == INI) { - if (QFile::exists(fileName) && !QFile::remove(fileName)) { - QMessageBox::critical(0, - tr("UAV Settings Export"), - tr("Unable to remove existing file: ") + fileName, - QMessageBox::Ok); - return; - } - - QSettings ini(fileName, QSettings::IniFormat); - QDomElement docElem = doc.documentElement(); - QDomNodeList nodeList = docElem.elementsByTagName("object"); - for (int i = 0; i < nodeList.count(); i++) { - QDomElement e = nodeList.at(i).toElement(); - if (!e.isNull()) { - ini.beginGroup(e.attribute("name", "undefined")); - ini.setValue("id", e.attribute("id")); - QDomNodeList n = e.elementsByTagName("field"); - for (int j = 0; j < n.count(); j++) { - QDomElement f = n.at(j).toElement(); - if (!f.isNull()) { - ini.setValue(f.attribute("name", "unknown"), f.attribute("values")); - } - } - ini.endGroup(); - } - } + QFile file(fileName); + if (file.open(QIODevice::WriteOnly) && + (file.write(doc.toString(4).toAscii()) != -1)) { + file.close(); + } else { + QMessageBox::critical(0, + tr("UAV Settings Export"), + tr("Unable to save settings: ") + fileName, + QMessageBox::Ok); + return; } + + QMessageBox msgBox; + msgBox.setText(tr("Settings saved.")); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.exec(); } void UAVSettingsImportExportPlugin::shutdown() diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.h b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.h index 60b0efd6a..17804326a 100644 --- a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.h +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.h @@ -28,6 +28,8 @@ #define UAVSETTINGSIMPORTEXPORT_H #include +#include "uavobjectutil/uavobjectutilmanager.h" +#include "importsummary.h" class UAVSettingsImportExportPlugin : public ExtensionSystem::IPlugin { @@ -42,7 +44,8 @@ public: void shutdown(); private slots: - void importExport(); + void importUAVSettings(); + void exportUAVSettings(); }; diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.pluginspec b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.pluginspec index 7b64a8e60..b40dc5b60 100644 --- a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.pluginspec +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.pluginspec @@ -7,5 +7,6 @@ + diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.pro b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.pro index 5f2b18103..b653864ed 100644 --- a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.pro +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport.pro @@ -1,13 +1,18 @@ - -TEMPLATE = lib -QT += xml - -TARGET = UAVSettingsImportExport - -include(../../openpilotgcsplugin.pri) -include(uavsettingsimportexport_dependencies.pri) - -HEADERS += uavsettingsimportexport.h -SOURCES += uavsettingsimportexport.cpp - -OTHER_FILES += uavsettingsimportexport.pluginspec + +TEMPLATE = lib +QT += xml + +TARGET = UAVSettingsImportExport + +include(../../openpilotgcsplugin.pri) +include(uavsettingsimportexport_dependencies.pri) + +HEADERS += uavsettingsimportexport.h \ + importsummary.h +SOURCES += uavsettingsimportexport.cpp \ + importsummary.cpp + +OTHER_FILES += uavsettingsimportexport.pluginspec + +FORMS += \ + importsummarydialog.ui diff --git a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport_dependencies.pri b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport_dependencies.pri index 4bb362f98..2bf87c3be 100644 --- a/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport_dependencies.pri +++ b/ground/openpilotgcs/src/plugins/uavsettingsimportexport/uavsettingsimportexport_dependencies.pri @@ -1,2 +1,3 @@ include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/uavobjects/uavobjects.pri) +include(../../plugins/uavobjectutil/uavobjectutil.pri) diff --git a/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.cpp b/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.cpp index 3cfe6dfe7..6a9d22d5f 100644 --- a/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.cpp +++ b/ground/openpilotgcs/src/plugins/uavtalk/uavtalk.cpp @@ -295,7 +295,7 @@ bool UAVTalk::processInputByte(quint8 rxbyte) } // Check the lengths match - if ((rxPacketLength + rxLength) != packetSize) + if ((rxPacketLength + rxLength + (rxObj->isSingleInstance() ? 0 : 2)) != packetSize) { // packet error - mismatched packet size stats.rxErrors++; rxState = STATE_SYNC; @@ -805,17 +805,3 @@ quint8 UAVTalk::updateCRC(quint8 crc, const quint8* data, qint32 length) crc = crc_table[crc ^ *data++]; return crc; } - - - - - - - - - - - - - - diff --git a/shared/uavobjectdefinition/attitudesettings.xml b/shared/uavobjectdefinition/attitudesettings.xml index af89cc0d6..e0007bbeb 100644 --- a/shared/uavobjectdefinition/attitudesettings.xml +++ b/shared/uavobjectdefinition/attitudesettings.xml @@ -4,7 +4,7 @@ - + diff --git a/shared/uavobjectdefinition/manualcontrolsettings.xml b/shared/uavobjectdefinition/manualcontrolsettings.xml index 0828932e4..95423a3f5 100644 --- a/shared/uavobjectdefinition/manualcontrolsettings.xml +++ b/shared/uavobjectdefinition/manualcontrolsettings.xml @@ -2,11 +2,11 @@ Settings to indicate how to decode receiver input by @ref ManualControlModule. - - - - - + + + + + diff --git a/shared/uavobjectdefinition/mixersettings.xml b/shared/uavobjectdefinition/mixersettings.xml index e1a1a6c5a..a93b8c2ff 100644 --- a/shared/uavobjectdefinition/mixersettings.xml +++ b/shared/uavobjectdefinition/mixersettings.xml @@ -6,23 +6,23 @@ - + - + - + - + - + - + - + - + - +