Many questions about 7 segment display modules
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Many questions about 7 segment display modules
Keith,
Both radios only need the 3+2 digit format.
I can post the code that I changed if you can refresh my memory on the formatting to place for pasting the code in this thread.
Both radios only need the 3+2 digit format.
I can post the code that I changed if you can refresh my memory on the formatting to place for pasting the code in this thread.
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Many questions about 7 segment display modules
I see it now.....here's what I am running right now....
Code: Select all
sim_value = "137.25"
--Reverse the string
sim_value = string.reverse(sim_value)
--format the string
sim_value = string.format("% 9.2f",sim_value*10)
-- Create a new Max7219 based character display
display_chr_id = hw_chr_display_add("NAV1 frequency", "MAX7219", 1)
-- Set text to the manipulated sim string value
hw_chr_display_set_text(display_chr_id, 0, 0, sim_value)
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Many questions about 7 segment display modules
No worries. So you just need the NAV radio?Kaellis991 wrote: ↑Fri Mar 24, 2023 6:19 pm Keith,
Both radios only need the 3+2 digit format.
I can post the code that I changed if you can refresh my memory on the formatting to place for pasting the code in this thread.
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: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Many questions about 7 segment display modules
Ultimately I will have both a COM and a NAV radio.
But both designed exactly the same.
But both designed exactly the same.
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Many questions about 7 segment display modules
Keith,
I have that code you created for the 6 digit display.
Is that something you can modify to incorporate what you just figured out for these 5 digit displays?
I have that code you created for the 6 digit display.
Is that something you can modify to incorporate what you just figured out for these 5 digit displays?
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Many questions about 7 segment display modules
Kirk,Kaellis991 wrote: ↑Fri Mar 24, 2023 6:43 pm Keith,
I have that code you created for the 6 digit display.
Is that something you can modify to incorporate what you just figured out for these 5 digit displays?
Let me do the NAV first then I will do the COM for you.
Give me a day or so for the NAV.
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: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Many questions about 7 segment display modules
Keith
Will this previous code you did help any or do you have it already?
Will this previous code you did help any or do you have it already?
Code: Select all
-- Simple code to display the active com2 frequency Xplane
--Create a var clear any values that may be on the display
com2_val = " "
nav2_val = " "
--A a MAX7219 hw_chr_display
raddeux_actv = hw_chr_display_add("com2 ACTV frequency", "MAX7219", 2)
--Subscribe to dataref and add function
xpl_dataref_subscribe("sim/cockpit2/radios/actuators/com2_frequency_hz_833", "INT",
"sim/cockpit/radios/nav2_freq_hz", "INT",function(new_com2_val,new_nav2_val )
--Replace com2_val value with the dataref new_com2_val and format
com2_val = string.format("% 9.04f", new_com2_val / 1000)
--Send the com2_val to the display
hw_chr_display_set_text(raddeux_actv, 0, 0, com2_val)
--Replace nav2_val value with the dataref new_nav2_val and format
nav2_val = string.format("% 9.04f", new_nav2_val/100)
--Send the nav2_val to the display
hw_chr_display_set_text(raddeux_actv, 1, 0, nav2_val)
end)
--Add dials to set frequencies
hw_dial_add("com2 Coarse","TYPE_2_DETENT_PER_PULSE", function(dir)
if dir == -1then xpl_command("sim/radios/actv_com2_coarse_down") end
if dir == 1then xpl_command("sim/radios/actv_com2_coarse_up") end
end)
hw_dial_add("com2 fine","TYPE_2_DETENT_PER_PULSE", function(dir)
if dir == -1then xpl_command("sim/radios/actv_com2_fine_down") end
if dir == 1then xpl_command("sim/radios/actv_com2_fine_up") end
end)
hw_dial_add("nav2 Coarse","TYPE_2_DETENT_PER_PULSE", function(dir)
if dir == -1then xpl_command("sim/radios/actv_nav2_coarse_down") end
if dir == 1then xpl_command("sim/radios/actv_nav2_coarse_up") end
end)
hw_dial_add("nav2 fine","TYPE_2_DETENT_PER_PULSE", function(dir)
if dir == -1then xpl_command("sim/radios/actv_nav2_fine_down") end
if dir == 1then xpl_command("sim/radios/actv_nav2_fine_up") end
end)
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Many questions about 7 segment display modules
Keith,
Thanks again for your help...
Thanks again for your help...
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Many questions about 7 segment display modules
Hi,
Here is the NAV radio. Please test and let me know if it is OK.
Keith
Here is the NAV radio. Please test and let me know if it is OK.
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: Many questions about 7 segment display modules
Nice job Kirk,Kaellis991 wrote: ↑Fri Mar 24, 2023 5:53 pm I changed <% 9.4f> to <% 9.2f> and now the decimal is in the correct location
FDF0C742-884D-457B-A97D-C6B926632770.jpeg
Joe. CISSP, MSc.