ttlappalainen / NMEA0183

Library for handling NMEA0183 messages
69 stars 44 forks source link

NMEA0183 combiner functionality #8

Closed usauerbrey closed 5 years ago

usauerbrey commented 5 years ago

Hi Timo In the example NMEA0183ToN2k you are mentioning "This example reads NMEA0183 messages from one serial port. It is possible to add more serial ports for having NMEA0183 combiner functionality." I tried to do this, but it was not successfully. Do you have an eample for na conmbine or can you give me a hint, how the several serial ports must be initialized concerning the setup of the NMEA0183 ports and handlers. Thanks in advance Best Regards Uwe

ttlappalainen commented 5 years ago

In the example there is NME0183 parser class: tNMEA0183 NMEA0183_3;

You should define a other class e.g. tNMEA0183 NMEA0183_2;

and do similar initialization as for NMEA0183_3, but naturally different port:

  NMEA0183_2.SetMsgHandler(HandleNMEA0183Msg);

  Serial2.begin(19200);
  NMEA0183_2.SetMessageStream(&Serial2);
  NMEA0183_2.Open();

You can use same handler or create own handler HandleNMEA0183Msg2. Also in loop you naturally add also NMEA0183_2.ParseMessages();

usauerbrey commented 5 years ago

Thanks für the hints, it works now Best Regards Uwe