mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-09-11 19:55:14 +02:00
Fix OBPFormatter when course values > 360° were shown as e.g. 370° instead of 010°
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "GwApi.h"
|
#include "GwApi.h"
|
||||||
#include "Pagedata.h"
|
#include "Pagedata.h"
|
||||||
|
#include "OBPDataOperations.h"
|
||||||
|
|
||||||
// ToDo
|
// ToDo
|
||||||
// simulation data
|
// simulation data
|
||||||
@@ -219,7 +220,7 @@ FormattedData formatValue(GwApi::BoatValue *value, CommonData &commondata, bool
|
|||||||
course = M_PI_2 + float(random(-17, 17) / 100.0); // create random course/wind values with 90° +/- 10°
|
course = M_PI_2 + float(random(-17, 17) / 100.0); // create random course/wind values with 90° +/- 10°
|
||||||
rawvalue = course;
|
rawvalue = course;
|
||||||
}
|
}
|
||||||
course = course * RAD_TO_DEG; // Unit conversion form rad to deg
|
course = WindUtils::to360(course * RAD_TO_DEG); // Unit conversion form rad to deg
|
||||||
|
|
||||||
// Format 3 numbers with prefix zero
|
// Format 3 numbers with prefix zero
|
||||||
snprintf(buffer,bsize,"%03.0f",course);
|
snprintf(buffer,bsize,"%03.0f",course);
|
||||||
|
|||||||
Reference in New Issue
Block a user