Repository: UCSolarCarTeam/Helios-Sentinel
Pull request #42: VSC-599: Changed Latitude/Longitude fields to floats
Author: login: SpencerVR1
Created: 2025-02-24T04:07:40Z | Merged: 2025-03-08T19:32:43Z

IMPORTANT: Merge at the same time as the PR for Mercury or else they won't be compatible


Diff:
diff --git a/content/FloatSpinBox.qml b/content/FloatSpinBox.qml
index 57bfcf2..ddb5ffd 100644
--- a/content/FloatSpinBox.qml
+++ b/content/FloatSpinBox.qml
@@ -8,6 +8,8 @@ Item {
     anchors.right: parent.right
     anchors.rightMargin: 0
 
+    property var range: {"from": -2147483648, "to": 2147483647}
+    property bool isCustomRange: range.from !== -2147483648 || range.to !== 2147483647
     property int decimals: 1
     readonly property int decimalFactor: Math.pow(10, decimals)
     property real inputValue: 0.0
@@ -28,13 +30,14 @@ Item {
         id: spinBox
         width: 110
         height: 25
-        from: -2147483648
-        to: 2147483647
+        font.pixelSize: 12
+        from: isCustomRange ? range.from * decimalFactor : range.from
+        to: isCustomRange? range.to * decimalFactor : range.to
         editable: true
         bottomPadding: 1
         topPadding: 1
         spacing: 5
-        wheelEnabled: true
+        wheelEnabled: false
         rightPadding: 25
         leftPadding: 25
         anchors.left: text1.right
@@ -61,4 +64,4 @@ Item {
         }
     }
     
-}
\ No newline at end of file
+}
diff --git a/content/IntSpinBox.qml b/content/IntSpinBox.qml
index b696bac..f6c35c7 100644
--- a/content/IntSpinBox.qml
+++ b/content/IntSpinBox.qml
@@ -25,6 +25,7 @@ Item {
         y: 0
         width: 110
         height: 25
+        font.pixelSize: 12
         from: range.from
         to: range.to
         editable: true
diff --git a/content/TelemetryView.qml b/content/TelemetryView.qml
index 590ff07..0ea15ee 100644
--- a/content/TelemetryView.qml
+++ b/content/TelemetryView.qml
@@ -26,14 +26,14 @@ Item {
                 width: 245
 
                 IntSpinBox {
-                    id: proximitySensor1
+                    id: gpsYear
                     text: qsTr("GPS Year")
                     value: telemetry.GpsYear
                     onValueChanged: telemetry.setGpsYear(value)
                 }
 
                 IntSpinBox {
-                    id: proximitySensor2
+                    id: gpsMonth
                     text: qsTr("GPS Month")
                     range: { "from": 0, "to": 12 }
                     value: telemetry.GpsMonth
@@ -41,7 +41,7 @@ Item {
                 }
 
                 IntSpinBox {
-                    id: proximitySensor3
+                    id: gpsDay
                     text: qsTr("GPS Day")
                     range: { "from": 0, "to": 31 }
                     value: telemetry.GpsDay
@@ -49,7 +49,7 @@ Item {
                 }
 
                 IntSpinBox {
-                    id: proximitySensor4
+                    id: gpsHour
                     text: qsTr("GPS Hour")
                     range: { "from": 0, "to": 23 }
                     value: telemetry.GpsHour
@@ -57,7 +57,7 @@ Item {
                 }
 
                 IntSpinBox {
-                    id: proximitySensor5
+                    id: gpsMinute
                     text: qsTr("GPS Minute")
                     range: { "from": 0, "to": 59 }
                     value: telemetry.GpsMinute
@@ -66,7 +66,7 @@ Item {
                 }
 
                 IntSpinBox {
-                    id: proximitySensor6
+                    id: gpsSecond
                     text: qsTr("GPS Second")
                     range: { "from": 0, "to": 59 }
                     value: telemetry.GpsSecond
@@ -75,7 +75,7 @@ Item {
                 }
 
                 IntSpinBox {
-                    id: proximitySensor7
+                    id: validityFlags
                     text: qsTr("Validity Flags")
                     range: { "from": 0, "to": 255 }
                     value: telemetry.GpsValidityFlags
@@ -84,7 +84,7 @@ Item {
                 }
 
                 IntSpinBox {
-                    id: proximitySensor8
+                    id: fixStatusFlags
                     text: qsTr("Fix Status Flags")
                     range: { "from": 0, "to": 255 }
                     value: telemetry.GpsFixStatusFlags
@@ -93,7 +93,7 @@ Item {
                 }
 
                 IntSpinBox {
-                    id: proximitySensor9
+                    id: additionalFlags
                     text: qsTr("Additional Flags")
                     range: { "from": 0, "to": 255 }
                     value: telemetry.GpsAdditionalFlags
@@ -107,66 +107,68 @@ Item {
                 spacing: 20
                 width: 245
 
-                IntSpinBox {
-                    id: proximitySensor10
+                FloatSpinBox {
+                    id: longitude
                     text: qsTr("Longitude")
-                    range: { "from": -2147483648, "to": 2147483647 }
-                    value: telemetry.GpsLongitude
-                    onValueChanged: telemetry.setGpsLongitude(value)
+                    range: { "from": -180, "to": 180 }
+                    decimals: 6;
+                    inputValue: telemetry.GpsLongitude
+                    onInputValueUpdated: telemetry.setGpsLongitude(inputValue)
                 }
 
-                IntSpinBox {
-                    id: proximitySensor11
+                FloatSpinBox {
+                    id: latitude
                     text: qsTr("Latitude")
-                    range: { "from": -2147483648, "to": 2147483647 }
-                    value: telemetry.GpsLatitude
-                    onValueChanged: telemetry.setGpsLatitude(value)
+                    range: { "from": -90, "to": 90 }
+                    decimals: 6;
+                    inputValue: telemetry.GpsLatitude
+                    onInputValueUpdated: telemetry.setGpsLatitude(inputValue)
                 }
 
                 IntSpinBox {
-                    id: proximitySensor12
+                    id: mpuTemperature
                     text: qsTr("MPU Temperature")
                     value: telemetry.MpuTemperature
                     onValueChanged: telemetry.setMpuTemperature(value)
                 }
 
                 IntSpinBox {
-                    id: proximitySensor13
+                    id: mpueAccelerationX
                     text: qsTr("MPU Acceleration X")
                     value: telemetry.MpuAccelerationX
                     onValueChanged: telemetry.setMpuAccelerationX(value)
                 }
 
                 IntSpinBox {
-                    id: proximitySensor14
+                    id: mpueAccelerationY
                     text: qsTr("MPU Acceleration Y")
                     value: telemetry.MpuAccelerationY
                     onValueChanged: telemetry.setMpuAccelerationY(value)
                 }
 
                 IntSpinBox {
-                    id: proximitySensor15
+                    id: mpueAccelerationZ
                     text: qsTr("MPU Acceleration Z")
                     value: telemetry.MpuAccelerationZ
                     onValueChanged: telemetry.setMpuAccelerationZ(value)
                 }
 
                 IntSpinBox {
-                    id: proximitySensor16
+                    id: mpuRotationX
                     text: qsTr("MPU Rotation X")
                     value: telemetry.MpuRotationX
                     onValueChanged: telemetry.setMpuRotationX(value)
                 }
 
                 IntSpinBox {
-                    id: proximitySensor17
+                    id: mpuRotationY
                     text: qsTr("MPU Rotation Y")
                     value: telemetry.MpuRotationY
                     onValueChanged: telemetry.setMpuRotationY(value)
                 }
 
                 IntSpinBox {
-                    id: proximitySensor18
+                    id: mpuRotationZ
                     text: qsTr("MPU Rotation Z")
                     value: telemetry.MpuRotationZ
                     onValueChanged: telemetry.setMpuRotationZ(value)
diff --git a/src/Telemetry.h b/src/Telemetry.h
index f79b061..70234ff 100644
--- a/src/Telemetry.h
+++ b/src/Telemetry.h
@@ -20,8 +20,8 @@ class Telemetry : public QObject
     DEFINE_PROPERTY_WHOLE_NUMBER(unsigned char, GpsValidityFlags, 9, 1)
     DEFINE_PROPERTY_WHOLE_NUMBER(unsigned char, GpsFixStatusFlags, 10, 1)
     DEFINE_PROPERTY_WHOLE_NUMBER(unsigned char, GpsAdditionalFlags, 11, 1)
-    DEFINE_PROPERTY_WHOLE_NUMBER(int, GpsLongitude, 12, 4)
-    DEFINE_PROPERTY_WHOLE_NUMBER(int, GpsLatitude, 16, 4)
+    DEFINE_PROPERTY_FLOAT(float, GpsLongitude, 12, 4)
+    DEFINE_PROPERTY_FLOAT(float, GpsLatitude, 16, 4)
     DEFINE_PROPERTY_WHOLE_NUMBER(unsigned short, MpuAccelerationX, 20, 2)
     DEFINE_PROPERTY_WHOLE_NUMBER(unsigned short, MpuAccelerationY, 22, 2)
     DEFINE_PROPERTY_WHOLE_NUMBER(unsigned short, MpuAccelerationZ, 24, 2)


Reviews:
user: login: UniqueNameHere21
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-24T16:46:42Z
user: login: UniqueNameHere21
body: sends the data properly, needs some modifications
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-02-25T02:10:28Z
user: login: UniqueNameHere21
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-01T18:49:33Z
user: login: UniqueNameHere21
body: ![image](https://github.com/user-attachments/assets/81c8a4cc-5f63-4762-8ec2-7a885c0c4343)

state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-04T01:30:47Z
user: login: UniqueNameHere21
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-08T19:32:30Z

Review comments:
diff_hunk: @@ -107,20 +107,18 @@ Item {
                 spacing: 20
                 width: 245
 
-                IntSpinBox {
+                FloatSpinBox {
                     id: proximitySensor10
path: content/TelemetryView.qml
user: login: UniqueNameHere21
body: Id
created_at: 2025-02-24T16:27:10Z
author_association: CONTRIBUTOR
diff_hunk: @@ -107,20 +107,18 @@ Item {
                 spacing: 20
                 width: 245
 
-                IntSpinBox {
+                FloatSpinBox {
                     id: proximitySensor10
                     text: qsTr("Longitude")
-                    range: { "from": -2147483648, "to": 2147483647 }
path: content/TelemetryView.qml
user: login: UniqueNameHere21
body: Add range for these 2 fields, latitude -90 to 90 and longitude -180 to 180
created_at: 2025-02-24T16:29:41Z
author_association: CONTRIBUTOR
diff_hunk: @@ -107,20 +107,18 @@ Item {
                 spacing: 20
                 width: 245
 
-                IntSpinBox {
+                FloatSpinBox {
                     id: proximitySensor10
                     text: qsTr("Longitude")
-                    range: { "from": -2147483648, "to": 2147483647 }
path: content/TelemetryView.qml
user: login: UniqueNameHere21
body: Also should be able to edit multiple decimal places for this as coordinates are very precise
created_at: 2025-02-25T02:10:03Z
author_association: CONTRIBUTOR
diff_hunk: @@ -23,7 +23,7 @@ Item {
     SpinBox {
         id: spinBox
         y: 0
-        width: 110
+        width: 120
path: content/IntSpinBox.qml
user: login: UniqueNameHere21
body: width change pushes boxes right against the border of page. See motor Details page
created_at: 2025-03-01T18:47:50Z
author_association: CONTRIBUTOR
diff_hunk: @@ -107,66 +107,70 @@ Item {
                 spacing: 20
                 width: 245
 
-                IntSpinBox {
-                    id: proximitySensor10
+                FloatSpinBox {
+                    id: longitude
                     text: qsTr("Longitude")
-                    range: { "from": -2147483648, "to": 2147483647 }
-                    value: telemetry.GpsLongitude
-                    onValueChanged: telemetry.setGpsLongitude(value)
+                    range: { "from": -180, "to": 180 }
+                    isCustomRange: true
path: content/TelemetryView.qml
user: login: UniqueNameHere21
body: is this needed?
created_at: 2025-03-01T18:48:34Z
author_association: CONTRIBUTOR
diff_hunk: @@ -107,66 +107,70 @@ Item {
                 spacing: 20
                 width: 245
 
-                IntSpinBox {
-                    id: proximitySensor10
+                FloatSpinBox {
+                    id: longitude
                     text: qsTr("Longitude")
-                    range: { "from": -2147483648, "to": 2147483647 }
-                    value: telemetry.GpsLongitude
-                    onValueChanged: telemetry.setGpsLongitude(value)
+                    range: { "from": -180, "to": 180 }
+                    isCustomRange: true
+                    decimals: 6;
+                    inputValue: telemetry.GpsLongitude
+                    onInputValueUpdated: telemetry.setGpsLongitude(inputValue)
                 }
 
-                IntSpinBox {
-                    id: proximitySensor11
+                FloatSpinBox {
+                    id: latitude
                     text: qsTr("Latitude")
-                    range: { "from": -2147483648, "to": 2147483647 }
-                    value: telemetry.GpsLatitude
-                    onValueChanged: telemetry.setGpsLatitude(value)
+                    range: { "from": -90, "to": 90 }
+                    isCustomRange: true
path: content/TelemetryView.qml
user: login: UniqueNameHere21
body: see above
created_at: 2025-03-01T18:49:04Z
author_association: CONTRIBUTOR

PR comments:
user: login: UniqueNameHere21
created_at: 2025-03-01T18:49:59Z
body: follow branch naming format VSCXXX-my-branch-name
author_association: CONTRIBUTOR
user: login: SpencerVR1
created_at: 2025-03-05T02:13:49Z
body: > ![image](https://private-user-images.githubusercontent.com/113066857/418796733-81c8a4cc-5f63-4762-8ec2-7a885c0c4343.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDExNDA5OTQsIm5iZiI6MTc0MTE0MDY5NCwicGF0aCI6Ii8xMTMwNjY4NTcvNDE4Nzk2NzMzLTgxYzhhNGNjLTVmNjMtNDc2Mi04ZWMyLTdhODg1YzBjNDM0My5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMzA1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDMwNVQwMjExMzRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04ZmRjMzgyMWQ0ODcyMWIwNDU3NGY0ODVmMWQ4ZjU3MGRkMDY4MWY0YzQyYjdlMWI2NTUzZWMzMzA0N2JjYjQ5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.nfxnBSmMfbd7kBfasspICvtDIXqnbtYVreAZ9NmYaSs)

Realized this error only happens when you use mouse button wheel/trackpad to modify the value of the spinbox. Seems that values were updating too quickly somehow so decided to just remove that functionality as it is not needed for float spinboxes
author_association: CONTRIBUTOR