Skip to content

Commit

Permalink
Update GPS output field and rounding method in Converter
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
BitsAndDroids committed Dec 6, 2023
1 parent ae8bbf7 commit 03bb162
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions dist/outputs.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
],
Expand Down
8 changes: 4 additions & 4 deletions utils/OutputConverters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <QString>
#include "OutputConverters.h"

#include <qdebug.h>
#include <iomanip>
#include <sstream>

Expand All @@ -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()) {
Expand All @@ -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;
}
Expand Down

0 comments on commit 03bb162

Please sign in to comment.