Sync repository
[mardrone] / mardrone / JoyStickCalibratorDesktop.qml
diff --git a/mardrone/JoyStickCalibratorDesktop.qml b/mardrone/JoyStickCalibratorDesktop.qml
new file mode 100644 (file)
index 0000000..deb435e
--- /dev/null
@@ -0,0 +1,424 @@
+import QtQuick 1.0
+import JoyStick 1.0
+import QtDesktop 0.1
+
+Item {
+    width: 600
+    height: 800
+    property int textSize:22
+    property int ctrlSize:40
+    ListModel {
+          id: axisMapModel
+          ListElement{ text:"Aileron";  mapAxis:1 }
+          ListElement { text:"Elevator"; mapAxis:2 }
+          ListElement { text:"Throtle";  mapAxis:3 }
+          ListElement { text:"Rudder";   mapAxis:4 }
+          ListElement { text:"none";     mapAxis:0 }
+   }
+     /*
+    ComboBox {
+        id: axisMap1UICombo;
+        model:  ListModel {
+          id: choicesMapAxis1
+          ListElement{ text:"Aileron";  mapAxis:1 }
+          ListElement { text:"Elevator"; mapAxis:2 }
+          ListElement { text:"Throtle";  mapAxis:3 }
+          ListElement { text:"Rudder";   mapAxis:4 }
+          ListElement { text:"none";     mapAxis:0 }
+          }
+        onSelectedIndexChanged: {
+            console.debug("onSelectedIndexChanged " + selectedText + ", " + choicesMapAxis1.get(selectedIndex).mapAxis);
+            js.mapAxis1=choicesMapAxis1.get(selectedIndex).mapAxis
+        }
+        selectedText:js.mapAxis1
+        KeyNavigation.tab: t1
+        KeyNavigation.backtab: button2
+     }
+
+    Menu {
+        id:js1map
+        visualParent:pageStack
+        MenuLayout {
+            MenuItem { text:"Aileron";  onClicked: { js.mapAxis1=1 }}
+            MenuItem { text:"Elevator"; onClicked: { js.mapAxis1=2 }}
+            MenuItem { text:"Throtle";  onClicked: { js.mapAxis1=3 }}
+            MenuItem { text:"Rudder";   onClicked: { js.mapAxis1=4 }}
+            MenuItem { text:"none";     onClicked: { js.mapAxis1=0 }}
+
+       }
+    }
+    Menu {
+        id:js2map
+        visualParent:pageStack
+        MenuLayout {
+            MenuItem { text:"Aileron";  onClicked: { js.mapAxis2=1 }}
+            MenuItem { text:"Elevator"; onClicked: { js.mapAxis2=2 }}
+            MenuItem { text:"Throtle";  onClicked: { js.mapAxis2=3 }}
+            MenuItem { text:"Rudder";   onClicked: { js.mapAxis2=4 }}
+            MenuItem { text:"none";     onClicked: { js.mapAxis2=0 }}
+
+       }
+    }
+    Menu {
+        id:js3map
+        visualParent:pageStack
+        MenuLayout {
+            MenuItem { text:"Aileron";  onClicked: { js.mapAxis3=1 }}
+            MenuItem { text:"Elevator"; onClicked: { js.mapAxis3=2 }}
+            MenuItem { text:"Throtle";  onClicked: { js.mapAxis3=3 }}
+            MenuItem { text:"Rudder";   onClicked: { js.mapAxis3=4 }}
+            MenuItem { text:"none";     onClicked: { js.mapAxis3=0 }}
+
+       }
+    }
+    Menu {
+        id:js4map
+        visualParent:pageStack
+        MenuLayout {
+            MenuItem { text:"Aileron";  onClicked: { js.mapAxis4=1 }}
+            MenuItem { text:"Elevator"; onClicked: { js.mapAxis4=2 }}
+            MenuItem { text:"Throtle";  onClicked: { js.mapAxis4=3 }}
+            MenuItem { text:"Rudder";   onClicked: { js.mapAxis4=4 }}
+            MenuItem { text:"none";     onClicked: { js.mapAxis4=0 }}
+
+       }
+    }
+    Menu {
+        id:js5map
+        visualParent:pageStack
+        MenuLayout {
+            MenuItem { text:"Aileron";  onClicked: { js.mapAxis5=1 }}
+            MenuItem { text:"Elevator"; onClicked: { js.mapAxis5=2 }}
+            MenuItem { text:"Throtle";  onClicked: { js.mapAxis5=3 }}
+            MenuItem { text:"Rudder";   onClicked: { js.mapAxis5=4 }}
+            MenuItem { text:"none";     onClicked: { js.mapAxis5=0 }}
+
+       }
+    }
+    Menu {
+        id:js6map
+        visualParent:pageStack
+        MenuLayout {
+            MenuItem { text:"Aileron";  onClicked: { js.mapAxis6=1 }}
+            MenuItem { text:"Elevator"; onClicked: { js.mapAxis6=2 }}
+            MenuItem { text:"Throtle";  onClicked: { js.mapAxis6=3 }}
+            MenuItem { text:"Rudder";   onClicked: { js.mapAxis6=4 }}
+            MenuItem { text:"none";     onClicked: { js.mapAxis6=0 }}
+
+       }
+    }
+*/
+ //   property Item jStick:
+    Column {
+        Text {
+            text:" "
+        }
+
+        Row {
+            Text {
+                text:"                  "
+            }
+            JoyStickIndicator {
+                border.width:1
+                width:100;height:100
+                xvalue:js.axis4
+                yvalue:js.axis3
+                Text {
+                    anchors.bottom: parent.bottom
+                    font.pixelSize: 10
+                    text:"       rudder"
+                }
+                Text {
+                    x:-10;y:50
+                    rotation:90
+                    font.pixelSize: 10
+                    text:"Throtle"
+                }
+            }
+
+            spacing:50
+            JoyStickIndicator {
+                border.width:1
+                width:100;height:100
+                xvalue:js.axis1
+                yvalue:js.axis2
+                Text {
+                    anchors.bottom: parent.bottom
+                    font.pixelSize: 10
+                    text:"      Aileron"
+                }
+                Text {
+                    x:-15;y:50
+                    rotation:90
+                    font.pixelSize: 10
+                    text:"Elevator"
+                }
+            }
+            Column {
+                Button{
+                    text:"Reset"
+                    onClicked:{
+                        js.calibrate=false
+                        pageStack.pop();
+                    }
+                }
+                Button{
+                    text:"Save"
+                    onClicked:{
+                        js.calibrate=false
+                        pageStack.pop();
+                    }
+                }
+        }
+        }
+        Grid {
+            spacing:10
+            columns:7
+            Text {
+                font.pixelSize  :textSize
+                text:"     Raw"
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:"     Max"
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:"     Min"
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:"Calib"
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:"value"
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:"reverse"
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:"mapping " + js.mapAxis1 + js.mapAxis2 + js.mapAxis3 + js.mapAxis4 +js.mapAxis5 +js.mapAxis6
+            }
+
+
+            Text {
+                font.pixelSize  :textSize
+                text:js.rawAxis1
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.maxAxis1
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.minAxis1
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.calAxis1.toFixed(2)
+            }
+            BarGauge {
+                width:100
+                height:20
+                val:js.calAxis1+1.0
+                max:2.0
+                horiz:true
+            }
+            CheckBox {
+                width:60
+       //         scale:0.8
+                checked:js.invertAxis1
+                onCheckedChanged:{js.invertAxis1=checked;}
+            }
+            ComboBox {
+                id: axisMap1UICombo;
+                model:  axisMapModel
+                onSelectedIndexChanged: {
+                    console.debug("onSelectedIndexChanged " + selectedText + ", " + axisMap1UICombo.get(selectedIndex).mapAxis);
+                    js.mapAxis1=caxisMap1UICombo.get(selectedIndex).mapAxis
+                }
+                selectedText:js.mapAxis1
+             }
+/*            Button{
+                width:200;height:ctrlSize
+                text:js.mapAxis1==1?"Aileron":js.mapAxis1==2?"Elevator":js.mapAxis1==3?"Throtle":js.mapAxis1==4?"Rudder":"none"
+                onClicked:js1map.open()
+            }
+*/
+
+
+            Text {
+                font.pixelSize  :textSize
+                text:js.rawAxis2
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.maxAxis2
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.minAxis2
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.calAxis2.toFixed(2)
+            }
+            BarGauge {
+                width:100
+                height:20
+                val:js.calAxis2+1.0
+                max:2.0
+                horiz:true
+            }
+            CheckBox {
+                checked:js.invertAxis2
+                onCheckedChanged:{js.invertAxis2=checked;}
+            }
+            Button{
+                width:200;height:ctrlSize
+                text:js.mapAxis2==1?"Aileron":js.mapAxis2==2?"Elevator":js.mapAxis2==3?"Throtle":js.mapAxis2==4?"Rudder":"none"
+                onClicked:js2map.open()
+            }
+
+
+
+            Text {
+                font.pixelSize  :textSize
+                text:js.rawAxis3
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.maxAxis3
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.minAxis3
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.calAxis3.toFixed(2)
+            }
+            BarGauge {
+                width:100
+                height:20
+                val:js.calAxis3+1.0
+                max:2.0               
+                horiz:true
+            }
+            CheckBox {
+                checked:js.invertAxis3
+                onCheckedChanged:{js.invertAxis3=checked;}
+            }
+            Button{
+                width:200;height:ctrlSize
+                text:js.mapAxis3==1?"Aileron":js.mapAxis3==2?"Elevator":js.mapAxis3==3?"Throtle":js.mapAxis3==4?"Rudder":"none"
+                onClicked:js3map.open()
+            }
+
+            Text {
+                font.pixelSize  :textSize
+                text:js.rawAxis4
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.maxAxis4
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.minAxis4
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.calAxis4.toFixed(2)
+            }
+            BarGauge {
+                width:100
+                height:20
+                val:js.calAxis4+1.0
+                max:2.0
+                horiz:true
+            }
+            CheckBox {
+                checked:js.invertAxis4
+                onCheckedChanged:{js.invertAxis4=checked;}
+            }
+            Button{
+                width:200;height:ctrlSize
+                text:js.mapAxis4==1?"Aileron":js.mapAxis4==2?"Elevator":js.mapAxis4==3?"Throtle":js.mapAxis4==4?"Rudder":"none"
+                onClicked:js4map.open()
+            }
+
+            Text {
+                font.pixelSize  :textSize
+                text:js.rawAxis5
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.maxAxis5
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.minAxis5
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.calAxis5.toFixed(2)
+            }
+            BarGauge {
+                width:100
+                height:20
+                val:js.calAxis5+1.0
+                max:2.0
+                horiz:true
+            }
+            CheckBox {
+                checked:js.invertAxis5
+                onCheckedChanged:{js.invertAxis5=checked;}
+            }
+            Button{
+                width:200;height:ctrlSize
+                text:js.mapAxis5==1?"Aileron":js.mapAxis5==2?"Elevator":js.mapAxis5==3?"Throtle":js.mapAxis5==4?"Rudder":"none"
+                onClicked:js5map.open()
+            }
+
+            Text {
+                font.pixelSize  :textSize
+                text:js.rawAxis6
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.maxAxis6
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.minAxis6
+            }
+            Text {
+                font.pixelSize  :textSize
+                text:js.calAxis6.toFixed(2)
+            }
+            BarGauge {
+                width:100
+                height:20
+                val:js.calAxis6+1.0
+                max:2.0
+                horiz:true
+            }
+            CheckBox {
+                checked:js.invertAxis6
+                onCheckedChanged:{js.invertAxis6=checked;}
+            }
+            Button{
+                width:200;height:ctrlSize
+                text:js.mapAxis6==1?"Aileron":js.mapAxis6==2?"Elevator":js.mapAxis6==3?"Throtle":js.mapAxis6==4?"Rudder":"none"
+                onClicked:js6map.open()
+            }
+        }
+
+    }
+}
+
+