I'm trying to create a script so that I can have redundancy if one CAN link fails for whatever reason. The gauges and all other sending and receiving should use CAN 1 but change to CAN 2 if CAN 1 fails.
I've been pulling my hair out all week and can't work out how to do it. This is my latest attempt using heartbeat messages to force updates but it still won't work. I've set a test gauge to the vStbdStrIndication tag and I am trying to update that value from either CAN tag. Is this the correct way to do this?
I've proven that I can get communication on both CAN 1 and CAN 2 but can't get the screen to swap between them. I've also set up on screen pictures which show that the Valid (timeout) tags are updating correctly so I'm pretty sure I'm missing something with the scripting.
Any help would be greatly appreciated. Thanks, Mitch
Code: Select all
public partial class Tags
{
void iStnHB_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
if (Globals.Tags.iError_No_Valid.Value == 1)
Globals.Tags.vStbdStrIndication.Value = Globals.Tags.iStbdStrIndication.Value;
else
Globals.Tags.vStbdStrIndication.Value = Globals.Tags._2iStbdStrIndication.Value;
}
void _2iStnHB_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
{
if (Globals.Tags.iError_No_Valid.Value == 0)
{
if (Globals.Tags._2iError_No_Valid.Value == 1)
Globals.Tags.vStbdStrIndication.Value = Globals.Tags._2iStbdStrIndication.Value;
else
Globals.Tags.vStbdStrIndication.Value = 1000;
}
}
}