Code: Select all
smWrite(VariableIDs.FreeFormCAN_TP_DM1_1, varFirstDM1);
Can we index VariableIDs and increment that index as we would any other variable? One workaround could be to static index all my DTCs and pack the unused DTCs with FF bytes? Sounds like overkill to send a 13 packet message full of FF's though.
The expedient route might be to shove all the DM1's through unique PGN 65226 messages on a 1000ms period. That leaves almost 50ms per DM1 if all 20 were active. Seems doable. However, I've found my 3 DM1 test sequentially smWriting the freeform can bytes then sendEventing them transmits the same DM1 3 times per 1000ms rather than 3 separate dm1s per 1000ms. I think there needs to be a pause and wait for the J1939 application to finish Tx Ext Free Form before sending the transition event on that state machine again.
Is there a simple method to handle timing in scripts?
The origin is one PV750, the destination is a 2nd PV750 displaying the DTCs using the MSTD approach. Potentially, this could need to be integrated into one PV750 using internal DM1 or similar.
My test case, transmits 3 SPN 333's back-to-back every time the script event SCR Check DM1s is called (as long as all conditional expressions evaluate to true):
Code: Select all
//---------------------------------------------------------------------------------------------
// Murphy Scripting
// - Leave EventName as $SCR Check DM1s$ for main script method
//---------------------------------------------------------------------------------------------
void $SCR Check DM1s$ ()
{
double var1;
double var2;
uint var3;
uint xmitready=1;
//smRead(VariableIDs.XMIT_ready,xmitready);
//if (smRead(VariableIDs.J1939_Engine_Engine_Oil_Pressure,var1) && var1 < 500)
if (smRead(VariableIDs.Test_Var1,var1) && var1 < 5 && xmitready==1)
{
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_Malfunction_Indicator_Lamp_Status, 0);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_Amber_Warning_Lamp_Status,1);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_Red_Stop_Lamp_Status, 0);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_Protect_Lamp_Status, 0);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_SPN, 111);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_FMI, 18);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_OC, 1);
sendEvent(EventIDs.TR_XMIT_DM1);
}
//if (smRead(VariableIDs.J1939_Engine_Engine_Oil_Temperature,var2) && var2 > 50)
if (smRead(VariableIDs.Test_Var2,var2) && var2 > 5 && xmitready==1)
{
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_Malfunction_Indicator_Lamp_Status, 0);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_Amber_Warning_Lamp_Status,0);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_Red_Stop_Lamp_Status, 1);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_Protect_Lamp_Status, 0);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_SPN, 222);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_FMI, 16);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_OC, 1);
sendEvent(EventIDs.TR_XMIT_DM1);
}
if (smRead(VariableIDs.Test_Var3,var3) && var3 > 30 && xmitready==1)
{
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_Malfunction_Indicator_Lamp_Status, 0);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_Amber_Warning_Lamp_Status,0);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_Red_Stop_Lamp_Status, 1);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_Protect_Lamp_Status, 0);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_SPN, 333);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_FMI, 16);
smWrite(VariableIDs.FreeFormCAN_DM1_XMIT_OC, 1);
sendEvent(EventIDs.TR_XMIT_DM1);
}
//smWrite(VariableIDs.Test_Var1,var1);
//smWrite(VariableIDs.Test_Var2,var2);
//var3=var3+1;
//smWrite(VariableIDs.Test_Var3,var3);
}