|
无法更换波特率,例如第一次打开的是500kbps函数,如果第二次打开的是250kbps函数,那么250会被强制改变成500kbps
例如第一次打开的是250kbps函数,第二次打开500kbps的函数,那么500会被强制改变为250
解决方式 关机重启选择250kb
canbus_close()函数也没用
还有一个问题是 CAN报文如何每隔100ms或者250ms循环发送
function on_init()
end
如果波特率写在初始化函数里 波特率将永远无法更改
function on_control_notify(screen,control,value)
if screen == screen_can_260 and control == 1 and value == 1 --eu260_screen = 103
then
canbus_open(0,500,0,0)
send_data_buffer[0] = 0x45
send_data_buffer[1] = 0x34
send_data_buffer[2] = 0x4d
send_data_buffer[3] = 0x00
send_data_buffer[4] = 0x17
send_data_buffer[5] = 0x70
send_data_buffer[6] = 0x0b
send_data_buffer[7] = 0x3a
canbus_write(0,CAN_CMD_ID_BAIC_EU260,8,0,0,send_data_buffer)
canbus_close(0)
end
if screen == screen_can_eu5 and control == 1 and value == 1 --eu5_screen = 104
then
canbus_open(0,250,0,0)
send_data_buffer[0] = 0x13
send_data_buffer[1] = 0x89
send_data_buffer[2] = 0x4D
send_data_buffer[3] = 0x90
send_data_buffer[4] = 0x3C
send_data_buffer[5] = 0x26
send_data_buffer[6] = 0x03
send_data_buffer[7] = 0xDE
canbus_write(0,CAN_CMD_ID_YEMA,8,0,0,send_data_buffer)
canbus_close(0)
end
end
|
|