Rotary Encoders stopped working after update to 4.1
-
- Posts: 7
- Joined: Sat Nov 12, 2022 4:58 pm
Rotary Encoders stopped working after update to 4.1
Hi all -
I have four rotary encoders connected to an Arduino Mega that have always functioned fine with 3.7. Yesterday I completely uninstalled 3.7 and updated to 4.1.
I flashed and added the Arduino just fine.
Under Create / Edit, I created a new script and pasted the one I had been using in 3.7 to control the rotary encoders.
The system sees my Arduino but when I 'Play' the script and attempt to turn the encoders, they don't show any actions in the Console window at all.
I know it's not my Arduino and encoder setup because I've since uninstalled 4.1 and gone back to the 3.7 version and all works like a charm as before.
Did something change between the two versions that I'm unaware of? I can't find anything online to help me.
I have four rotary encoders connected to an Arduino Mega that have always functioned fine with 3.7. Yesterday I completely uninstalled 3.7 and updated to 4.1.
I flashed and added the Arduino just fine.
Under Create / Edit, I created a new script and pasted the one I had been using in 3.7 to control the rotary encoders.
The system sees my Arduino but when I 'Play' the script and attempt to turn the encoders, they don't show any actions in the Console window at all.
I know it's not my Arduino and encoder setup because I've since uninstalled 4.1 and gone back to the 3.7 version and all works like a charm as before.
Did something change between the two versions that I'm unaware of? I can't find anything online to help me.
-
- Posts: 5339
- Joined: Thu Jul 27, 2017 12:22 am
Re: Rotary Encoders stopped working after update to 4.1
Could you please post your logic.lua, so we could confirm on our side ?LittleWing918 wrote: ↑Sat Nov 12, 2022 5:05 pm Hi all -
I have four rotary encoders connected to an Arduino Mega that have always functioned fine with 3.7. Yesterday I completely uninstalled 3.7 and updated to 4.1.
I flashed and added the Arduino just fine.
Under Create / Edit, I created a new script and pasted the one I had been using in 3.7 to control the rotary encoders.
The system sees my Arduino but when I 'Play' the script and attempt to turn the encoders, they don't show any actions in the Console window at all.
I know it's not my Arduino and encoder setup because I've since uninstalled 4.1 and gone back to the 3.7 version and all works like a charm as before.
Did something change between the two versions that I'm unaware of? I can't find anything online to help me.
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Rotary Encoders stopped working after update to 4.1
Hi,
Did you update the plugin? And did you reflash the Arduino?
Keith
Did you update the plugin? And did you reflash the Arduino?
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
-
- Posts: 7
- Joined: Sat Nov 12, 2022 4:58 pm
Re: Rotary Encoders stopped working after update to 4.1
I did re-flash the Arduino and it shows up that it's connected. I also have the latest plugin installed on both XP-11 and XP-12.
Here's the script. It works great on 3.7 but doesn't do anything on 4.1.
When I turn the encoders, they show up in the Console window going 'clockwise' or 'counterclockwise' in 3.7.
In 4.1 the console window doesn't show anything.
function dial_vor1_callback(direction)
if direction == 1 then
xpl_command("sim/radios/obs1_down")
print("clockwise")
elseif direction == -1 then
xpl_command("sim/radios/obs1_up")
print("counterclockwise")
end
end
hw_dial_add("ARDUINO_MEGA2560_A_D28", "ARDUINO_MEGA2560_A_D29", dial_vor1_callback)
function dial_vor2_callback(direction)
if direction == 1 then
xpl_command("sim/radios/obs2_down")
print("clockwise")
elseif direction == -1 then
xpl_command("sim/radios/obs2_up")
print("counterclockwise")
end
end
hw_dial_add("ARDUINO_MEGA2560_A_D27", "ARDUINO_MEGA2560_A_D26", dial_vor2_callback)
function dial_heading_indicator_callback(direction)
if direction == 1 then
xpl_command("sim/instruments/DG_sync_up")
print("clockwise")
elseif direction == -1 then
xpl_command("sim/instruments/DG_sync_down")
print("counterclockwise")
end
end
hw_dial_add("ARDUINO_MEGA2560_A_D23", "ARDUINO_MEGA2560_A_D22", dial_heading_indicator_callback)
function dial_headingbug_callback(direction)
if direction == 1 then
xpl_command("sim/autopilot/heading_up")
print("clockwise")
elseif direction == -1 then
xpl_command("sim/autopilot/heading_down")
print("counterclockwise")
end
end
hw_dial_add("ARDUINO_MEGA2560_A_D24", "ARDUINO_MEGA2560_A_D25", dial_headingbug_callback)
Here's the script. It works great on 3.7 but doesn't do anything on 4.1.
When I turn the encoders, they show up in the Console window going 'clockwise' or 'counterclockwise' in 3.7.
In 4.1 the console window doesn't show anything.
function dial_vor1_callback(direction)
if direction == 1 then
xpl_command("sim/radios/obs1_down")
print("clockwise")
elseif direction == -1 then
xpl_command("sim/radios/obs1_up")
print("counterclockwise")
end
end
hw_dial_add("ARDUINO_MEGA2560_A_D28", "ARDUINO_MEGA2560_A_D29", dial_vor1_callback)
function dial_vor2_callback(direction)
if direction == 1 then
xpl_command("sim/radios/obs2_down")
print("clockwise")
elseif direction == -1 then
xpl_command("sim/radios/obs2_up")
print("counterclockwise")
end
end
hw_dial_add("ARDUINO_MEGA2560_A_D27", "ARDUINO_MEGA2560_A_D26", dial_vor2_callback)
function dial_heading_indicator_callback(direction)
if direction == 1 then
xpl_command("sim/instruments/DG_sync_up")
print("clockwise")
elseif direction == -1 then
xpl_command("sim/instruments/DG_sync_down")
print("counterclockwise")
end
end
hw_dial_add("ARDUINO_MEGA2560_A_D23", "ARDUINO_MEGA2560_A_D22", dial_heading_indicator_callback)
function dial_headingbug_callback(direction)
if direction == 1 then
xpl_command("sim/autopilot/heading_up")
print("clockwise")
elseif direction == -1 then
xpl_command("sim/autopilot/heading_down")
print("counterclockwise")
end
end
hw_dial_add("ARDUINO_MEGA2560_A_D24", "ARDUINO_MEGA2560_A_D25", dial_headingbug_callback)
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Rotary Encoders stopped working after update to 4.1
Hi,
If you operate the dials/encoders via the console does it work. If it does then you have a arduino issue.
Try and re-flash and make sure they are connected.
Keith
If you operate the dials/encoders via the console does it work. If it does then you have a arduino issue.
Try and re-flash and make sure they are connected.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: Rotary Encoders stopped working after update to 4.1
Your first step is to confirm if your script works by adding prints. Also as Keith mentioned, see if it works with a software dial.
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Rotary Encoders stopped working after update to 4.1
Ralph the code is fine. I tested in create/edit and his print statements work 100%
It is a arduino connection issue.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
-
- Posts: 7
- Joined: Sat Nov 12, 2022 4:58 pm
Re: Rotary Encoders stopped working after update to 4.1
The Arduino shows that it's connected. I've re-flashed it several times to make sure.
Also – I've reverted back to 3.7 three different times now and everything works fine, but when I update to 4.1 each time (reflash the arduino and update plugin) I'm seeing nothing in the console window.
How do I operate it via the Console? (I'm completely stumped)
Also – I've reverted back to 3.7 three different times now and everything works fine, but when I update to 4.1 each time (reflash the arduino and update plugin) I'm seeing nothing in the console window.
How do I operate it via the Console? (I'm completely stumped)
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Rotary Encoders stopped working after update to 4.1
Hi,
Are you sure the Arduino channel is correct?
Keith
Are you sure the Arduino channel is correct?
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card
Re: Rotary Encoders stopped working after update to 4.1
It is definitely being flashed as mega 2560 "A" ?
edit - ha, thinking on the same lines.
edit - ha, thinking on the same lines.
Joe. CISSP, MSc.