Math utilty bc

Suggest new features here
VE3RD
Posts: 113
Joined: Thu Oct 11, 2018 7:21 pm

Math utilty bc

Post by VE3RD »

The nextion screens we use on the TGIF Spots requires "bc" to do some computations
We run a script that sets the USB2Serial Interface, and sets either Degrees F or C
and loads the NextionDrtiver section into /etc/mmdvmhost
and sets SendUserDataMask=0b00011110

Then it loads bc and sets a firewall rule.

The script fails loading bc until after a pistar-update is run in an ssh shell,
Running the update from within the pi-star dashboard does not allow bc to be found.

My request is to have bc loaded into the image

Thanks
Phil VE3RD
User avatar
MW0MWZ
Site Admin
Posts: 1505
Joined: Wed Apr 04, 2018 9:15 pm
Location: Wales, UK
Contact:

Re: Math utilty bc

Post by MW0MWZ »

VE3RD wrote: Tue Feb 13, 2024 2:47 am The nextion screens we use on the TGIF Spots requires "bc" to do some computations
We run a script that sets the USB2Serial Interface, and sets either Degrees F or C
and loads the NextionDrtiver section into /etc/mmdvmhost
and sets SendUserDataMask=0b00011110

Then it loads bc and sets a firewall rule.

The script fails loading bc until after a pistar-update is run in an ssh shell,
Running the update from within the pi-star dashboard does not allow bc to be found.

My request is to have bc loaded into the image

Thanks
Phil VE3RD
Let me try that again, removed my first reply because I read this properly the 2nd time...

"loads the NextionDrtiver section into /etc/mmdvmhost" - The dashboard will now do this too, I am working toward bringging in support for NextionDriver properly at the moment.

"sets SendUserDataMask=0b00011110" - Interesting, I need to go read NextionDriver again and see what that does, maybe it will become the default...

What does your bc calculation do? there may be other ways to do that?

And what version does this apply to?
Andy

73 de MW0MWZ
http://pistar.uk
VE3RD
Posts: 113
Joined: Thu Oct 11, 2018 7:21 pm

Re: Math utilty bc

Post by VE3RD »

Nextion Driver Version is 1.25, the same as in the image
not sure of all the bc functions other than deg F/C conversions
SendUserDataMask
Choose for which pages all user data (if found) is sent.
Set the bit for the corresponding page :
For TGIF Spots we set
0b00000001 DStar - No
0b00000010 DMR - yes
0b00000100 YSF - yes
0b00001000 P25 - yes
0b00010000 NXDN - yes
0b00100000 POCSAG - no
0b01000000 M17 - no

My full setup script can be found at
https://github.com/EA7KDO/Scripts/blob/master/IND.sh
VE3RD
Posts: 113
Joined: Thu Oct 11, 2018 7:21 pm

Re: Math utilty bc

Post by VE3RD »

@MW0MWZ
I revised our script to assume the nextion driver binary is already loaded
and added a few things that were loaded by the on7lds install script and were not present in the image.

Item 2 in the script must be run in order to get the nextion driver to function in a TGIFSPOT
One thing that you will not be able to add are the interactive scripts that are run from the screen that need to be loaded manually. These differ for different screens.

https://github.com/EA7KDO/Scripts/blob/master/IND42.sh

Will probably have to revise this script again when you get 4,2,1 released

Phil VE3RD
User avatar
MW0MWZ
Site Admin
Posts: 1505
Joined: Wed Apr 04, 2018 9:15 pm
Location: Wales, UK
Contact:

Re: Math utilty bc

Post by MW0MWZ »

4.2.1 is now out and seemingly working correctly, keep in mind that I have to balance users with nextion screens, along with those who don't have them too, so while it should make a good starting point for you, you may still have to customise it.

for bc, it's available in Bullseye just fine

Code: Select all

pi-star@pi-star(ro):~# apt-cache search bc | grep ^bc
bc - GNU bc arbitrary precision calculator language
A quick

Code: Select all

sudo apt install -y bc
Should get you where you need to be.
Andy

73 de MW0MWZ
http://pistar.uk
VE3RD
Posts: 113
Joined: Thu Oct 11, 2018 7:21 pm

Re: Math utilty bc

Post by VE3RD »

Thanks Andy
Robert installed a clean 4.2.1 and could not get his screen to come alive. I played with the sequence he used to configure the hotspot and found
that if there is no NextionDriver section in /etc/mmdvmhost and we set Display type to Nextion then Pi-Star sets
a Nextion Driver section that does not work with our setup, Therefore I have updated our script with an option
to remove the pi-star injected section with one that looks like this.

[NextionDriver]
SendUserDataMask=0b00011110
Port=/dev/ttyUSB0
DataFilesPath=/usr/local/etc/
LogLevel=2
GroupsFile=groups.txt
DMRidFile=stripped.csv
DMRidDelimiter=,
DMRidId=1
DMRidCall=2
DMRidName=3
DMRidX1=5
DMRidX2=6
DMRidX3=7
ShowModeStatus=1
RemoveDim=0
WaitForLan=1
SleepWhenInactive=0

I like your handling of the groups.text file (except for the typo on the groups file name) so will revise my script accordingly,
We download the stripped.csv file direct from radioid.net and use it for other things as well.
The DMRids 5, 6, and 7 are City,State/Prov,Country and are sent directly to the selected pages

Bottom Line. We are happy with the way it is now. We adapt as required to make our screens work.

Phil VE3RD
User avatar
MW0MWZ
Site Admin
Posts: 1505
Joined: Wed Apr 04, 2018 9:15 pm
Location: Wales, UK
Contact:

Re: Math utilty bc

Post by MW0MWZ »

VE3RD wrote: Sat Feb 17, 2024 10:19 pm I like your handling of the groups.text file (except for the typo on the groups file name) so will revise my script accordingly,
Uh oh, what did I typo?

The Users data comes from the same place, I just stage it on the pistar update platform so that we don't hammer upstream bandwidth.

The dashboard will ONLY add the Nextion Settings if they are missing, so if yours are already there, it will not change them, eventually they should end up in the factory configs.

There are some dashboard changes coming to the screen selection, but that should not give you any issue either.

Suggestions welcome of course.
Andy

73 de MW0MWZ
http://pistar.uk
VE3RD
Posts: 113
Joined: Thu Oct 11, 2018 7:21 pm

Re: Math utilty bc

Post by VE3RD »

I changed
GroupsFile=nextionGroups.txt
to
GroupsFile=groups.txt

The Raw image has no NextionDriver Section
The problem ONLY arose when Robert set the screen type=Nextion and did an apply changes,
This added the PiStar version of the NextionDriver Section, which I had to remove.

If we run our IND42.sh script before trying to configure pi-star, all is fine. Everything works just fine

one onscreen selection that would be nice is the Modem vs Usb2tty interface selection
The temperature def F / C selection in my script is obsolete as the screen shows both

Phil VE3RD
User avatar
MW0MWZ
Site Admin
Posts: 1505
Joined: Wed Apr 04, 2018 9:15 pm
Location: Wales, UK
Contact:

Re: Math utilty bc

Post by MW0MWZ »

VE3RD wrote: Sat Feb 17, 2024 11:40 pm I changed
GroupsFile=nextionGroups.txt
to
GroupsFile=groups.txt

The Raw image has no NextionDriver Section
The problem ONLY arose when Robert set the screen type=Nextion and did an apply changes,
This added the PiStar version of the NextionDriver Section, which I had to remove.

If we run our IND42.sh script before trying to configure pi-star, all is fine. Everything works just fine

one onscreen selection that would be nice is the Modem vs Usb2tty interface selection
The temperature def F / C selection in my script is obsolete as the screen shows both

Phil VE3RD
OK, nextionGroups.txt is provided by the hostfiles update process too, just in case you need/want it.
Andy

73 de MW0MWZ
http://pistar.uk
g4egh
Posts: 6
Joined: Mon Feb 10, 2020 12:55 pm

Re: Math utilty bc

Post by g4egh »

Greetings,

I had a working install of Pistar 4.1.2 and decided to rebuild it. I built 4.2.1

I am running a Nextion screen that prior to the rebuild all fields worked. The screen is the 3.5 inch version, dated 8th October 2022, by EA7KDO.

Initially, the CPU temps in F and C showed nothing. I then installed the Nextion driver, over the top of the one incorporated in Pi-star and now something does show, but makes no sense. I see sh: 1.*F and /usr/lo/ *C in the "F" and "C" boxes respectively. (I have substituted a * for the degree symbol I actually see).

My driver installation:

git clone https://github.com/on7lds/NextionDriverInstaller.git (Obtain driver)

sudo NextionDriverInstaller/install.sh (Install driver)


The other fields seem to populate OK.

I have installed "BC" which seemed to install OK: sudo apt-get install bc Having completed rpi updates first.

Should also mention that I built the new Pistar, but ran the backup files into it, which all seemed ok.

So, a bit lost here, and would appreciate a little guidance.

Thanks and 73,

Stan, G4EGH
Post Reply