This is what that code produces...Keith Baxter wrote: ↑Fri Mar 24, 2023 5:24 pm Kirk,
I just thought of something try this.
KeithCode: Select all
sim_value = "123.05" --Reverse the string sim_value = string.reverse(sim_value) --format the string sim_value = string.format("% 9.4f",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)
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 Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Many questions about 7 segment display modules
Awesom it moved the decimal one place to the right. Lets move it to the left.
OK lets change line 8 to.
string.format("% 9.4f",sim_value*10)
Keith
OK lets change line 8 to.
string.format("% 9.4f",sim_value*10)
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
It looks like the only change you made was from .....sim_value/10 to ....sim_value*10
And that as in line 7...
With that we get this
And that as in line 7...
With that we get this
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Many questions about 7 segment display modules
Great at least we have the decimal in the correct place.
Now we nee to move the display to the left two places.
try changing <"% 9.2f"> and play around with .?f and see which way the digits move.
So go <"% 9.3f"> <"% 9.2f"> < "% 9.5f">
Keith
Now we nee to move the display to the left two places.
try changing <"% 9.2f"> and play around with .?f and see which way the digits move.
So go <"% 9.3f"> <"% 9.2f"> < "% 9.5f">
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
I changed <% 9.4f> to <% 9.2f> and now the decimal is in the correct location
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Many questions about 7 segment display modules
Then change the sim_value variable to 137.25
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Many questions about 7 segment display modules
Awesome I now know how to sort out the NAV radio for you.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
A big coding "hack" , but at least we got there.
The ADF is not going to be that easy because frequencies go from 100.0 to 1799.5 .
That might meen you will have to live with leading 0's (0100.0)
Keith
Last edited by Keith Baxter on Sat Mar 25, 2023 3:02 pm, edited 1 time in total.
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
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Many questions about 7 segment display modules
Change the format to <% 9.1f> and the value to 100.0
Keith
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,Keith Baxter wrote: ↑Fri Mar 24, 2023 5:59 pmAwesome I now know how to sort out the NAV radio for you.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
A big coding "hack" , but at least we got there.
The ADF is not going to be that easy because frequencies go from 100.0 to 1799.5 .
That might meen you will have to live with leading 0's (0100.0)
Keith
I am not needing an ADF radio, just the COM and NAV
- Keith Baxter
- Posts: 4674
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Many questions about 7 segment display modules
How many digits do you have on tour com radio?
Try the last code change anyway for me please. In case someone else need it.
Thanks
Try the last code change anyway for me please. In case someone else need it.
Thanks
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