Comments (4)
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.
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.
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.
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)
- MWV True wind != Theoretical wind HOT 2
- LatLonToDouble(const char *data, const char sign) return 0 instead NA when given "" HOT 1
- Added GSV parser HOT 3
- ParseDPT, DBS or DBK missing HOT 4
- Duplicate definitions of the NMEA2000 object HOT 2
- NMEA checksum should accept lowercase HOT 2
- Parsing NMEA messages should be robust against to much fields HOT 5
- Missing class name for breaktime in NMEA0183Messages.cpp and missing macro in NMEA0183Msgs.h HOT 1
- Unit problem in ROT (and others?) HOT 1
- RMC sentence missing field 12, Status - NMEA v2.3 and later HOT 2
- glonass HOT 1
- Use library to only parse sentence HOT 1
- Checksum use ? (Always ON?) HOT 6
- HDG,HDM,HDT conversion to 127250 (and reverse conversion in N2kDataToNMEA0183)
- Basic Issue HOT 25
- RMC sentence field GPS time missing leading zeros HOT 4
- Question: how to use NMEA0183ParseGSV_nc HOT 2
- Leading zeros missing in RMC HOT 4
- Any way to display the Library version number for reference? HOT 7
- Improvement to allow correct Parsing of VHW STW data for NASA Electromagnetic Log
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nmea0183.