/*@!Encoding:936*/
includes
{
}
variables
{
message ESC_125 meg1;
msTimer Timer1;
long Cycle_Timer1;
int Button1;
int VehicleSpeedVD1;
long VehicleSpeed1;
}
//Create a message
on message ESC_125
{
// (0)=0x11;
// (1)=0x12;
// =8;
//CANFD message sending flag
meg1.FDF = 1;
meg1.BRS = 1;
}
//Create a timer
on timer Timer1
{
output(meg1);
setTimer(Timer1,Cycle_Timer1);
}
//Write default values to corresponding controls in the panel
on start
{
sysSetVariableInt(sysvar::TestOne::Button,1);//The default value of the Button-bound control is 1, open state
sysSetVariableInt(sysvar::TestOne::Length,8);//The value of Length binding is 8 by default
sysSetVariableInt(sysvar::TestOne::Cycle_Time,50);//Cycle_Time bound control default value is 50
sysSetVariableInt(sysvar::TestOne::VehicleSpeedVD,0);//0x0:Valid,0x1:Invalid
sysSetVariableInt(sysvar::TestOne::VehicleSpeed,0);//The default value of vehicle speed is 0
}
//Click the button to trigger periodic sending of messages
on sysvar_update sysvar::TestOne::Button
{
Button1 = @this;
if(Button1 == 1)
{
setTimer(Timer1,Cycle_Timer1);
}
else
{
cancelTimer(Timer1);
}
}
//Change the length manually in the panel
on sysvar_update sysvar::TestOne::Length
{
meg1.DLC=@this;
}
//Change the period value manually in the panel
on sysvar_update sysvar::TestOne::Cycle_Time
{
Cycle_Timer1=@this;
}
//Manually change the effective speed value in the panel
on sysvar_update sysvar::TestOne::VehicleSpeedVD
{
VehicleSpeedVD1=@this;
meg1.ESC_VehicleSpeedVD.phys=VehicleSpeedVD1;
}
//Change the speed value manually in the panel
on sysvar_update sysvar::TestOne::VehicleSpeed
{
VehicleSpeed1=@this;
meg1.ESC_VehicleSpeed.phys=VehicleSpeed1;
}