1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-16 07:23:07 +01:00

more formatters for UI

This commit is contained in:
andreas
2021-11-06 20:57:20 +01:00
parent ecad013d09
commit 1e09112e76
3 changed files with 76 additions and 47 deletions

View File

@@ -27,3 +27,56 @@ String GwBoatData::toJson() const {
serializeJson(json,buf);
return buf;
}
double formatCourse(double cv)
{
double rt = cv * 180.0 / M_PI;
if (rt > 360)
rt -= 360;
if (rt < 0)
rt += 360;
return rt;
}
double formatDegToRad(double deg){
return deg/180.0 * M_PI;
}
double formatWind(double cv)
{
double rt = formatCourse(cv);
if (rt > 180)
rt = 180 - rt;
return rt;
}
double formatKnots(double cv)
{
return cv * 3600.0 / 1852.0;
}
uint32_t mtr2nm(uint32_t m)
{
return m / 1852;
}
double mtr2nm(double m)
{
return m / 1852;
}
double kelvinToC(double v)
{
return v - 273.15;
}
double formatLatitude(double v){
return v;
}
double formatLongitude(double v){
return v;
}
double formatFixed0(double v){
return v;
}
double formatDepth(double v){
return v;
}
uint32_t formatFixed0(uint32_t v){
return v;
}