mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2026-10-30 10:12:41 +01:00
PageCurrent: Limit leeway size when STW is too small
This commit is contained in:
1 parent
88dfa84cc8
commit
eaa1f793ff
1 file changed
+6
-3
@@ -106,12 +106,15 @@ private:
|
||||
double stw // speed through water (m/s)
|
||||
)
|
||||
{
|
||||
if (stw == 0) {
|
||||
return 0;
|
||||
static constexpr double MINSTW = 0.5; // minimum speed (m/s) for leeway calculation to prevent math explosion
|
||||
static constexpr double MAXLAY = 30.0 * DEG_TO_RAD; // cap leeway at this level of degree;
|
||||
|
||||
if (stw < MINSTW) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
double lay = leeK * roll / (stw * stw);
|
||||
return lay;
|
||||
return std::min(lay, MAXLAY);
|
||||
}
|
||||
|
||||
double calcCTW(
|
||||
|
||||
Reference in new issue
Block a user