Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- btn1="SET,0,INPUT0,STEP,1,2,10."
- btn2="SET,0,INPUT0,STEP,3,3,10."
- btn3="SET,0,INPUT0,STEP,4,5,10."
- btn4="SET,0,INPUT0,STEP,6,6,10."
- btn5="SET,0,INPUT0,STEP,7,7,10."
- btn6="SET,0,INPUT0,STEP,8,8,10."
- btn7="SET,0,OUTPUT0,STEP,6,6,20."
- btn8="SET,0,OUTPUT0,STEP,7,7,20."
- btn9="SET,0,INPUT0,STEP,1,2,-10."
- btn10="SET,0,INPUT0,STEP,3,3,-10."
- btn11="SET,0,INPUT0,STEP,4,5,-10."
- btn12="SET,0,INPUT0,STEP,6,6,-10."
- btn13="SET,0,INPUT0,STEP,7,7,-10."
- btn14="SET,0,INPUT0,STEP,8,8,-10."
- btn15="SET,0,OUTPUT0,STEP,6,6,-20."
- btn16="SET,0,OUTPUT0,STEP,7,7,-20."
- btn17="SET,0,INPUT0,MUTE,1,2,1."
- btn18="SET,0,INPUT0,MUTE,3,3,1."
- btn19="SET,0,INPUT0,MUTE,4,5,1."
- btn20="SET,0,INPUT0,MUTE,6,6,1."
- btn21="SET,0,INPUT0,MUTE,7,7,1."
- btn22="SET,0,INPUT0,MUTE,8,8,1."
- btn23="SET,0,OUTPUT0,MUTE,6,6,1."
- btn24="SET,0,OUTPUT0,MUTE,7,7,1."
- btn25="SET,0,INPUT0,MUTE,1,8,1."
- btn25_="SET,0,OUTPUT0,MUTE,1,8,1."
- btn17_1="SET,0,INPUT0,MUTE,1,2,0."
- btn18_1="SET,0,INPUT0,MUTE,3,3,0."
- btn19_1="SET,0,INPUT0,MUTE,4,5,0."
- btn20_1="SET,0,INPUT0,MUTE,6,6,0."
- btn21_1="SET,0,INPUT0,MUTE,7,7,0."
- btn22_1="SET,0,INPUT0,MUTE,8,8,0."
- btn23_1="SET,0,OUTPUT0,MUTE,6,6,0."
- btn24_1="SET,0,OUTPUT0,MUTE,7,7,0."
- btn25_1="SET,0,INPUT0,MUTE,1,8,0."
- btn25_2="SET,0,OUTPUT0,MUTE,1,8,0."
- btn26="SET,0,PRESET,ID,0,0,1."
- request_in ="GET,0,INPUT0,MUTE,1,8,0."
- request_out ="GET,0,OUTPUT0,MUTE,1,8,0."
- _G.l1mut = 0
- _G.l2mut = 0
- function net_send(msg)
- local tmp = {}
- for i = 1, #msg do
- tmp[i-1] = msg[i]
- end
- client_send_data(tmp)
- end
- local wificom = 0
- local mode = 1
- local server_port = '5557'
- local server_ip = '10.0.255.186'
- local dhcp = 0
- local ipaddr = '10.0.255.123'
- local netmask = '255.255.255.0'
- local gateway = '10.0.255.1'
- local dns = '10.0.255.1'
- function on_init()
- start_timer(1, 1000, 1, 0)
- set_network_cfg(dhcp, ipaddr, netmask, gateway, dns)
- --set_network_service_cfg(wificom, mode, server_port, server_ip)
- save_network_cfg()
- sockfd=udp_create(12345)
- end
- function on_timer(timer_id)
- if timer_id ==1 then
- byte_cmd(request_in)
- rcvudp(sockfd)
- byte_cmd(request_out)
- rcvudp(sockfd)
- if _G.l1mut ==1 and _G.l2mut ==1 then
- set_value(0,17,1)
- end
- if _G.l1mut ==0 and _G.l2mut ==0 then
- set_value(0,17,0)
- end
- end
- end
- function on_control_notify(screen,control,value)
- if screen == 0 then
- if control >0 and control <=16 and value==1 then
- byte_cmd(_G["btn".. tostring(control)])
- end
- if control >16 and control < 25 and value==1 then
- byte_cmd(_G["btn".. tostring(control)])
- end
- if control >16 and control < 25 and value==0 then
- byte_cmd(_G["btn".. tostring(control).. '_1'])
- end
- if control ==26 and value==1 then
- byte_cmd(btn26)
- end
- if control ==25 and value==1 then
- byte_cmd(btn25)
- byte_cmd(btn25_)
- end
- if control ==25 and value==0 then
- byte_cmd(btn25_1)
- byte_cmd(btn25_2)
- end
- end
- end
- function byte_cmd (cmd)
- local cmd_loc = {}
- for i = 1, cmd:len() do
- cmd_loc[i-1] = cmd:byte(i)
- end
- udp_sendto(sockfd, server_ip, server_port, cmd_loc)
- end
- function rcvudp(sockfd)
- local ret,ip,port,packet = udp_recvfrom(sockfd)
- local packet_str = ""
- for _, ch in ipairs(packet) do
- packet_str = packet_str .. string.char(ch)
- end
- print(packet_str)
- if packet_str:find("ET0,INPUT0,MUTE,1,1,1") then _G.l1mut =1 end
- if packet_str:find("ET0,INPUT0,MUTE,2,2,1") then _G.l2mut =1 end
- if packet_str:find("ET0,INPUT0,MUTE,1,1,0") then _G.l1mut =0 end
- if packet_str:find("ET0,INPUT0,MUTE,2,2,0") then _G.l2mut =0 end
- print(_G.l1mut)
- print(_G.l2mut)
- end
Add Comment
Please, Sign In to add comment