Git Product home page Git Product logo

Comments (4)

ttlappalainen avatar ttlappalainen commented on September 15, 2024
void tN2kDataToNMEA0183::SendRMC() {
    if ( NextRMCSend<=millis() && !N2kIsNA(Latitude) ) {

Above takes care of SendRMC() timing. Write similar for each message.

The other tests just disables data by setting them to NA after timeout, if you do not receive them. After e.g. Latitude has been disabled, SendRMC does not send it anymore. Without disabling values your system would just continue to send old data for coming future, if you loss e.g. Lat/Lon. That would not be safe.

By the way. The Update will called in loop with high speed so to save some calculations on loop every time I use in my projects setting timeout insteat of Last... value:
...
PositionTimeout=millis()+4000;
...
if ( PositionTimeout<millis() ) { Latitude=N2kDoubleNA; Longitude=N2kDoubleNA; }
...
Then you save that summing on all tests.

from nmea0183.

ronzeiller avatar ronzeiller commented on September 15, 2024

Thank you Timo, that you took care and helped me to get on the right track again.

In deed I got confused with the < millis() and the resulting logic!

And I got confused by an example code from somebody else, based on the NMEA2000ToWiFiAsSeaSmart example, where suddenly NMEA0183DoubleNA values where shown.....
But this is clear to me now.
And then I also had a closer look at the NMEA0183setXXX() functions in NMEA0183Messages.cpp, where you always test if a value!=NMEA0183DoubleNA too.

It is an example of course showing principles, but would it be wise in production code to even parse N2k GNSS if I do not want to send?
In other words: would it be not better to do the timing in the incoming HandleMsg() part for example?

from nmea0183.

ttlappalainen avatar ttlappalainen commented on September 15, 2024

N2k messages will be parsed, when they arrives. That is set on main.cpp with NMEA2000.AttachMsgHandler(&N2kDataToNMEA0183); Then library calls tN2kDataToNMEA0183::HandleMsg(const tN2kMsg &N2kMsg) on NMEA2000.ParseMessages() when message arrives. GNSS lat/long will be then parsed, even you will not forward them to NMEA0183. Naturally also other values could be kept global as I do in other system.

As you see some of the messages like HDT will be forwarded directly from HandleMsg.

One note about mixed data on NMEA2000. You may easily have several GNSS or HDT messages on your system. Due to small inaccuracy between devices, you should also have possiblity to select priority for those and use highest priority device data as far it is available. This simple example does not handle that and if you have e.g. GPS, Airmar weather station and Transmitting AIS on your bus, NMEA0183 data will be mixed by those. For handling devices you need to use N2kDeviceList module.

from nmea0183.

ronzeiller avatar ronzeiller commented on September 15, 2024

Thank you Timo and also thanks for the hint about the mixed devices, I will take care, but have to read more about this in your great library and examples!

from nmea0183.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.