From 03bb162d3249b67da2cbdf439904828b4108b6d2 Mon Sep 17 00:00:00 2001 From: bitsanddroids Date: Wed, 6 Dec 2023 20:05:56 +0100 Subject: [PATCH] Update GPS output field and rounding method in Converter The output field name has been updated from "GPS COURSE TO STEER" to "GPS WP BEARING" with its frequency and measurement metric adjusted. The integer conversion in the output converter now applies rounding to the received value to maintain data precision. --- dist/outputs.json | 8 ++++---- utils/OutputConverters.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/outputs.json b/dist/outputs.json index b10468f..8d9e585 100644 --- a/dist/outputs.json +++ b/dist/outputs.json @@ -506,12 +506,12 @@ }, { "id": 100, - "outputName": "GPS COURSE TO STEER", - "metric": "Radians", - "updateEvery": 0.01, + "outputName": "GPS WP BEARING", + "metric": "Degrees", + "updateEvery": 1, "dataType": 0, "cbText":"GPS course to steer", - "prefix":454 , + "prefix":454, "type":0 } ], diff --git a/utils/OutputConverters.cpp b/utils/OutputConverters.cpp index 2a59e88..b131c4d 100644 --- a/utils/OutputConverters.cpp +++ b/utils/OutputConverters.cpp @@ -4,7 +4,7 @@ #include #include "OutputConverters.h" - +#include #include #include @@ -19,13 +19,13 @@ int OutputConverters::radianToDegree(float rec) { } std::string OutputConverters::formatOutgoingString(float received, Output output) { - int intVal = 0; + int intVal; std::string prefix = std::to_string(output.getPrefix()); //Ensure the prefix is 4 characters long for (int i = (int)prefix.size(); i < 4; i++) { prefix += " "; } - + qDebug() << "received: " << received; std::string input_string; switch (output.getType()) { @@ -35,7 +35,7 @@ std::string OutputConverters::formatOutgoingString(float received, Output output break; } case INTEGERMODE: { - intVal = (int)received; + intVal = (int)std::round(received); input_string = prefix + std::to_string(intVal); break; }