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

Move buffer handling to obp60task; reset OBPSensorTask; add true wind calculation

This commit is contained in:
Ulrich Meine
2025-07-19 00:26:37 +02:00
parent bb99978177
commit c48c6a2e48
5 changed files with 287 additions and 71 deletions

View File

@@ -0,0 +1,48 @@
#pragma once
// #include <Python.h>
#include "GwApi.h"
#include <Arduino.h>
#include <math.h>
// #define radians(a) (a*0.017453292519943295)
// #define degrees(a) (a*57.29577951308232)
class WindUtils {
public:
static void to360(double* a);
static void to180(double* a);
static void to2PI(double* a);
static void toPI(double* a);
static void toCart(const double* phi, const double* r, double* x, double* y);
static void toPol(const double* x, const double* y, double* phi, double* r);
static void addPolar(const double* phi1, const double* r1,
const double* phi2, const double* r2,
double* phi, double* r);
static bool calcTrueWind(const double* awaVal, const double* awsVal,
const double* cogVal, const double* stwVal, const double* hdtVal,
const double* hdmVal, double* twdVal, double* twsVal);
static void calcTwdSA(const double* AWA, const double* AWS,
const double* CTW, const double* STW, const double* HDT,
double* TWD, double* TWS);
};
/*
// make function available in Python for testing
static PyObject* true_wind(PyObject* self, PyObject* args);
static PyMethodDef methods[] = {
{"true_wind", true_wind, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
};
static struct PyModuleDef module = {
PyModuleDef_HEAD_INIT,
"truewind", // Module name
NULL, // Optional docstring
-1,
methods
};
PyMODINIT_FUNC PyInit_truewind(void) {
return PyModule_Create(&module);
} */