Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporarly Disabled ForwardStream #111

Closed
melucas opened this issue May 4, 2018 · 5 comments
Closed

Temporarly Disabled ForwardStream #111

melucas opened this issue May 4, 2018 · 5 comments

Comments

@melucas
Copy link

melucas commented May 4, 2018

Hi,

Using the TemperatureMonitor example, I have the Forward of the N2k data setup tp send to the USB serial port as follows:

NMEA2000.SetForwardStream(&Serial);
NMEA2000.SetForwardType(tNMEA2000::fwdt_Text);

I am adding a configuration menu to the serial port and need a way to pause/disable to ForwardStream.
So far, the only way I can get the N2k output to stop and running the menu off the screen is to:

NMEA2000.EnableForward(false);

Before writing the menu and then:

NMEA2000.EnableForward(true);

After the menu is exited. This works, but it stops the flow of the data onto the N2k bus and my Raymarine MFD eventually resets the data display to --.

What is the correct way to pause the ForwardStream and then restart it?

Thank you,
Michael

@ttlappalainen
Copy link
Owner

EnableForward is the right way, but I do not see why it would have any effect to the N2k bus traffic. There seem to be small configuration bug on forward bit definitions: static const int FwdModeBit_EnableForward They should be static const unsigned int FwdModeBit_EnableForward, but it should not have any effect.

Have you checked that data flow really stops and your loop continues running normally?

@melucas
Copy link
Author

melucas commented May 6, 2018

You are right. I my loops waiting for serial input I was not calling the N2K processing.

I've added that in and now it seems to be ignoring the NMEA2000.EnableForward(false); which I set before I display the menu. My MFD is getting the data, but I'm also seeing the N2K output on the serial console.

  1. Do I have to close the N2K connection and re open it after changing the EnableForward mode?
  2. How can I access the value of ForwardMode or FwdModeBit_EnableForward so I can check it in my loop processing? The are both protected variables and not accessible from my code.

Thank you,
Michael

@melucas
Copy link
Author

melucas commented May 6, 2018

I figured out item 1 above. I was not calling NMEA2000.EnableForward(false); in the right order before displaying the menu.

Still looking for a suggestion on item 2 above.

@ttlappalainen
Copy link
Owner

Currently there is no way. In principle bool ForwardEnabled() const could be public.

@melucas
Copy link
Author

melucas commented May 6, 2018

Can you add that to your feature request list?
I can work around that now using a variable in my code.
Thanks,
Michael

@melucas melucas closed this as completed May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants