Compare commits

...

4 commits
v2.1 ... master

Author SHA1 Message Date
Dominic Reich
f4d67fe4b5
updated README and added code_excerpts 2023-01-12 11:48:05 +01:00
4b22bac81b
Update README.md
also fix url in 7" folder
2022-12-21 14:15:31 +01:00
94e260caa3
Update README.md
fix url
2022-12-21 14:14:50 +01:00
Dominic Reich
946ae33596
Update 7" screen
- system page to new button names "HOTSPOT ON/OFF"
- added some linux files to make use of them as example
  files in "/usr/local/sbin/"
2020-04-27 21:28:32 +02:00
19 changed files with 623 additions and 5 deletions

View file

@ -10,7 +10,7 @@ or my website [oe7drt.com](https://oe7drt.com) is well appreciated.
[I made a blog post][blog post] about this screen.
[blog post]: https://oe7drt.com/blog/nextion-dmr-last-heard-dashboard/
[blog post]: https://oe7drt.com/posts/2020-02-16-nextion-dmr-last-heard-dashboard/
# Preview

View file

@ -13,7 +13,7 @@ or my website [oe7drt.com](https://oe7drt.com) is well appreciated.
[I made a blog post][blog post] about this screen.
[blog post]: https://oe7drt.com/blog/my-7inch-dmr-dashboard/
[blog post]: https://oe7drt.com/posts/2020-02-16-nextion-dmr-last-heard-dashboard/
# Preview

View file

@ -0,0 +1,72 @@
# Useful files to keep on your Raspberry Pi
Use these files as examples and modify them to fit your needs.
Place the executable files in `/usr/local/sbin` and save `index.txt` as
`/root/index.html`.
## index.txt
This file contains the website that is shown when you stop the dashboard. It gets
copied into the webroot of your webserver -- make sure your webserver reads
`index.html` files **before** `index.php` files.
## dashboard
Executable file. Make sure to `chmod +x` this file.
Start or stop the dashboard with this command. This toggles the systemd service
- php7.3-fpm.service
Usage:
```
/usr/local/sbin/dashboard {on|off}
```
## hotspot
Executable file. Make sure to `chmod +x` this file.
Start or stop your hotspot. This toggles the systemd services
- mmdvmhost.timer
- mmdvmhost.service
Additionally it starts or stops the dashboard command mentioned above.
Usage:
```
/usr/local/sbin/hotspot {on|off}
```
### Start and stop the hotspot via Cron
Place these lines in your `/etc/crontab` to automatically start and/or stop
your hotspot.
```
30 6 * * 1-5 root /usr/local/sbin/hotspot off
0 18 * * 1-5 root /usr/local/sbin/hotspot on
```
That might stop the hotspot at 6:30 and start it again at 18:00, Monday to Friday.
## shrinklog
Executable file. Make sure to `chmod +x` this file.
This command shrinks the MMDVMHost log file to a limited number of important
lines.
The code of this was primarily taken from [Pi-Star][shrinklog] and modified.
[shrinklog]: https://github.com/AndyTaylorTweet/Pi-Star_Binaries_sbin/blob/master/pistar-hourly.cron
Usage:
```
/usr/local/sbin/shrinklog
```

View file

@ -0,0 +1,26 @@
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "root privileges needed. Aborting."
exit
fi
case "$1" in
start|on)
echo -n "Starting the web dashboard..."
systemctl start php7.3-fpm.service
rm -f /var/www/html/index.html
echo " OK"
;;
stop|off)
echo -n "Stopping the web dashboard..."
cp -a /root/index.html /var/www/html/index.html
systemctl stop php7.3-fpm.service
echo " OK"
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
esac

View file

@ -0,0 +1,27 @@
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "root privileges needed. Aborting."
exit 1
fi
case "$1" in
on)
systemctl start mmdvmhost.timer
systemctl start mmdvmhost.service
/usr/local/sbin/dashboard on
;;
off)
systemctl stop mmdvmhost.timer
systemctl stop mmdvmhost.service
/usr/local/sbin/dashboard off
;;
help)
echo "$(basename $0)"
echo " Enable or disable systemd services for MMDVMHost"
;;
*)
echo "usage: $(basename $0) [ on | off ]"
exit 1
esac

View file

@ -0,0 +1,35 @@
<!DOCTYPE html><html lang="de_AT">
<head>
<meta charset="utf-8">
<meta name='HandheldFriendly' content='True'>
<meta name='MobileOptimized' content='320'>
<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1'>
<title>OE7DRT - MMDVM-Dashboard by DG9VH</title>
<style>
.center {
font-family: Input, Monospace, fixed;
font-size: 110%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
@media only screen
and (max-width : 500px) {
.center {
font-size: 80%;
}
}
</style>
</head>
<body>
<div class="center">
<p>The dashboard is not available right now, please try
again later!<br><br>
<a href="#" onclick="location.reload(true);
return false;">reload this page</a>
</div>
</body>
</html>

View file

@ -0,0 +1,26 @@
#!/bin/bash
# This code was taken from Pi-Star (and maybe modified a bit)
# https://github.com/AndyTaylorTweet/Pi-Star_Binaries_sbin/blob/master/pistar-hourly.cron
echo -n "Shrinking MMDVM log..."
# Shrink the MMDVMHost Log
MMDVMLogFiles=$(ls /var/log/mmdvm/MMDVM-*.log 2> /dev/null | wc -l)
if [[ "$MMDVMLogFiles" != "0" ]]; then
todayMMDVMLog=$(ls -1rt /var/log/mmdvm/MMDVM-*.log | tail -n1)
modemLine=$(grep "MMDVM protocol version" ${todayMMDVMLog} | tail -n 1)
if [ "$(head -n 1 ${todayMMDVMLog})" = "${modemLine}" ]; then
sed -i '1d' ${todayMMDVMLog}
fi
echo -e "${modemLine}\n$(egrep -h "from|end|watchdog|lost|protocol" ${todayMMDVMLog} | sed '/(CSBK|overflow|mapping points|Downlink)/d' | tail -n 500)" > ${todayMMDVMLog}
#echo -e "${modemLine}\n$(egrep -h "from|end|watchdog|lost|protocol" ${todayMMDVMLog} | sed '/(CSBK|overflow|mapping points|Downlink)/d' | tail -n 1000)" > ${todayMMDVMLog}
fi
echo -n " /var/log..."
# Clean up systemd logs
journalctl --rotate > /dev/null 2>&1
#journalctl --vacuum-time=24h
#journalctl --vacuum-size=5M
journalctl --vacuum-time=6h > /dev/null 2>&1
journalctl --vacuum-size=2M > /dev/null 2>&1
echo " OK"

Binary file not shown.

Before

(image error) Size: 70 KiB

After

(image error) Size: 55 KiB

View file

@ -5,7 +5,12 @@ This is a collection of Nextion Screen Layouts that I have made.
The bigger screens usually run with a higher baudrate of 115200. With 9600
the screen may flicker a little bit.
## Files in this repo (2020-03-20)
~~## Files in this repo (2020-04-27)~~
## Files in this repo (2023-01-12)
As I updated the repo with some excerpts of code that is used within
those files.
```
MMDVM-Nextion-Screen-Layouts
@ -18,10 +23,25 @@ MMDVM-Nextion-Screen-Layouts
│   └── screens.png
├── 70
│   └── LastHeard-Dashboard-Multislot-Enhanced
│   ├── linux
│   │   ├── dashboard
│   │   ├── hotspot
│   │   ├── index.txt
│   │   ├── README.md
│   │   └── shrinklog
│   ├── Multi-LH-DMR-NX8048K070_011.HMI
│   ├── Multi-LH-DMR-NX8048K070_011.tft
│   ├── README.md
│   └── nxt07_screens.png
│   ├── nxt07_01.png
│   └── README.md
├── code_excerpts
│   ├── 24_S0.txt
│   ├── 70_DMR_PostInit.txt
│   ├── 70_MMDVM_PreInit.txt
│   ├── 70_S0.txt
│   ├── 70_SYSTEM_PreInit.txt
│   ├── 70_tm0.txt
│   ├── info.txt
│   └── README.md
├── LICENSE
└── README.md
```

61
code_excerpts/24_S0.txt Normal file
View file

@ -0,0 +1,61 @@
st.val=MMDVM.status.val
if(MMDVM.status.val>60)
{
if(MMDVM.status.val<69)
{
// SLOT 1
if(MMDVM.status.val==64)
{
lst.txt="TS1: "
substr t0.txt,tmp2.txt,4,27
lst.txt+=tmp2.txt
// Call END SLOT 1
if(now.txt!=t0.txt)
{
// for now we use the full src information
// with Slot and RF/NET information
lh5.txt=lh4.txt
tg5.txt=tg4.txt
lh4.txt=lh3.txt
tg4.txt=tg3.txt
lh3.txt=lh2.txt
tg3.txt=tg2.txt
lh2.txt=lh1.txt
tg2.txt=tg1.txt
lh1.txt=now.txt
tg1.txt=tg.txt
now.txt=t0.txt
tg.txt=t1.txt
//substr t0.txt,now.txt,4,100
lst.txt=""
}
}
}else if(MMDVM.status.val<78)
{
// SLOT 2
if(MMDVM.status.val==72)
{
lst.txt="TS2: "
substr t2.txt,tmp2.txt,4,27
lst.txt+=tmp2.txt
// Call END SLOT 2
if(now.txt!=t2.txt)
{
lh5.txt=lh4.txt
tg5.txt=tg4.txt
lh4.txt=lh3.txt
tg4.txt=tg3.txt
lh3.txt=lh2.txt
tg3.txt=tg2.txt
lh2.txt=lh1.txt
tg2.txt=tg1.txt
lh1.txt=now.txt
tg1.txt=tg.txt
now.txt=t2.txt
tg.txt=t3.txt
//substr t2.txt,now.txt,4,100
lst.txt=""
}
}
}
}

View file

@ -0,0 +1,50 @@
// The following is going to execute after we load this current page:
//
// There is something strange when I read the RTC for the first time
// without a battery, or when you just inserted a battery for the first time.
// Some of the values are random generated and beyond the limits. For example, the
// day would show as 45, month as 20, minute as 65, etc. I was like: "What?!!!"
// And we can't modify them using normal buttons because they are coded to
// take to current value and increase or decrease that value, and the RTC
// don't take values beyond the limits. For that reason I am going to check
// if any of the components of the RTC are beyond the limits, and if they are
// I will take them to a valid value:
// This must run on "Postinitialize Event" on page 0.
if(rtc0>2099) // if year is above 2099
{
rtc0=2099 // set year as 2099
}
//
if(rtc1>12) // if month is above 12
{
rtc1=12 // set month as 12
}
//
if(rtc1==0) // if month is equal to 0
{
rtc1=1 // set month as 1
}
//
if(rtc2>31) // if day is above 31
{
rtc2=1 // set day as 1
}
//
if(rtc2==0) // if day is equal to 0
{
rtc2=1 // set day as 1
}
//
if(rtc3>23) // if hour is above 23
{
rtc3=23 // set hour as 23
}
//
if(rtc4>59) // if minute is above 59
{
rtc4=0 // set minute as 0
}
if(rtc5>59) // if second is above 59
{
rtc5=59 // set second as 59
}

View file

@ -0,0 +1,6 @@
bauds=115200
//bauds=9600
// get and set brightness
repo SYSTEM.va0.val,10
dim=SYSTEM.va0.val
page DMR

170
code_excerpts/70_S0.txt Normal file
View file

@ -0,0 +1,170 @@
st.val=MMDVM.status.val
// MMDVM Stuff
if(MMDVM.status.val>60)
{
if(MMDVM.status.val<69)
{
// SLOT 1
if(enabled1.val==0)
{
if(MMDVM.status.val==62)
{
slot1t.val=0
tm1.en=1
enabled1.val=1
}
}
if(MMDVM.status.val==64)
{
// Call END SLOT 1
tm1.en=0
enabled1.val=0
substr t0.txt,tmp2.txt,4,100
if(now.txt!=tmp2.txt)
{
// copy line 3 to 4
lh4.txt=lh3.txt
ber4.txt=ber3.txt
rssi4.txt=rssi3.txt
time4.txt=time3.txt
p4.txt=p3.txt
tg4.txt=tg3.txt
// copy line 2 to 3
lh3.txt=lh2.txt
ber3.txt=ber2.txt
rssi3.txt=rssi2.txt
time3.txt=time2.txt
p3.txt=p2.txt
tg3.txt=tg2.txt
// copy line 1 to 2
lh2.txt=lh1.txt
ber2.txt=ber1.txt
rssi2.txt=rssi1.txt
time2.txt=time1.txt
p2.txt=p1.txt
tg2.txt=tg1.txt
// copy line 0 to 1
lh1.txt=now.txt
ber1.txt=ber.txt
rssi1.txt=rssi.txt
time1.txt=time0.txt
p1.txt=p0.txt
tg1.txt=tg.txt
// get line 0 from MMDVMHost
substr t0.txt,now.txt,4,100
ber.txt=t6.txt
rssi.txt=t4.txt
// Uhrzeit Minuten
time0.txt=""
covx rtc3,va5.txt,2,0
time0.txt+=va5.txt
time0.txt+=":"
// Sekunden
covx rtc4,va7.txt,2,0
time0.txt+=va7.txt
// Durchgang SECONDS p0.txt
sec_rest.val=slot1t.val
sec_rest.val%=20
sec.val=slot1t.val
sec.val/=20
// Rest in Dezimalstellen rechnen
sec_rest.val*=5
p0.txt=""
covx sec.val,p0.txt,0,0
p0.txt+="."
covx sec_rest.val,sec_tmp.txt,0,0
substr sec_tmp.txt,sec_tmp2.txt,0,1
p0.txt+=sec_tmp2.txt
p0.txt+="s"
slot1t.val=0
substr t0.txt,tg.txt,0,1
tg.txt+="-"
tg.txt+=t1.txt
t4.txt=""
t6.txt=""
}
}
}else if(MMDVM.status.val<78)
{
// SLOT 2
if(enabled2.val==0)
{
if(MMDVM.status.val==70)
{
slot2t.val=0
tm2.en=1
enabled2.val=1
}
}
if(MMDVM.status.val==72)
{
// Call END SLOT 2
tm2.en=0
enabled2.val=0
substr t2.txt,tmp2.txt,4,100
if(now.txt!=tmp2.txt)
{
// copy line 3 to 4
lh4.txt=lh3.txt
ber4.txt=ber3.txt
rssi4.txt=rssi3.txt
time4.txt=time3.txt
p4.txt=p3.txt
tg4.txt=tg3.txt
// copy line 2 to 3
lh3.txt=lh2.txt
ber3.txt=ber2.txt
rssi3.txt=rssi2.txt
time3.txt=time2.txt
p3.txt=p2.txt
tg3.txt=tg2.txt
// copy line 1 to 2
lh2.txt=lh1.txt
ber2.txt=ber1.txt
rssi2.txt=rssi1.txt
time2.txt=time1.txt
p2.txt=p1.txt
tg2.txt=tg1.txt
// copy line 0 to 1
lh1.txt=now.txt
ber1.txt=ber.txt
rssi1.txt=rssi.txt
time1.txt=time0.txt
p1.txt=p0.txt
tg1.txt=tg.txt
// get line 0 from MMDVMHost
substr t2.txt,now.txt,4,100
ber.txt=t7.txt
rssi.txt=t5.txt
// Uhrzeit Minuten
time0.txt=""
covx rtc3,va5.txt,2,0
time0.txt+=va5.txt
time0.txt+=":"
// Sekunden
covx rtc4,va7.txt,2,0
time0.txt+=va7.txt
// Durchgang SECONDS p0.txt
sec_rest.val=slot2t.val
sec_rest.val%=20
sec.val=slot2t.val
sec.val/=20
// Rest dezimal -> Sekunden: rest/100*60
sec_rest.val*=5
p0.txt=""
covx sec.val,p0.txt,0,0
p0.txt+="."
covx sec_rest.val,sec_tmp.txt,0,0
substr sec_tmp.txt,sec_tmp2.txt,0,1
p0.txt+=sec_tmp2.txt
p0.txt+="s"
slot2t.val=0
substr t2.txt,tg.txt,0,1
tg.txt+="-"
tg.txt+=t3.txt
t5.txt=""
t7.txt=""
}
}
}
}

View file

@ -0,0 +1,10 @@
repo h0.val,10
repo n0.val,10
// show display version
// and serial number
printh 2A
printh FC
printh 02
printh FF
printh FF
printh FF

89
code_excerpts/70_tm0.txt Normal file
View file

@ -0,0 +1,89 @@
// RTC Clock
// va0 = time string variable
// t_time = text field name
//
// weekday
if(rtc6==0)
{
va1.txt="Sonntag"
}else if(rtc6==1)
{
va1.txt="Montag"
}else if(rtc6==2)
{
va1.txt="Dienstag"
}else if(rtc6==3)
{
va1.txt="Mittwoch"
}else if(rtc6==4)
{
va1.txt="Donnerstag"
}else if(rtc6==5)
{
va1.txt="Freitag"
}else if(rtc6==6)
{
va1.txt="Samstag"
}
va0.txt=va1.txt
va0.txt+=", "
// day
covx rtc2,va1.txt,0,0
va0.txt+=va1.txt
va0.txt+=". "
// add month
if(rtc1==1)
{
va1.txt="Jänner"
}else if(rtc1==2)
{
va1.txt="Februar"
}else if(rtc1==3)
{
va1.txt="März"
}else if(rtc1==4)
{
va1.txt="April"
}else if(rtc1==5)
{
va1.txt="Mai"
}else if(rtc1==6)
{
va1.txt="Juni"
}else if(rtc1==7)
{
va1.txt="Juli"
}else if(rtc1==8)
{
va1.txt="August"
}else if(rtc1==9)
{
va1.txt="September"
}else if(rtc1==10)
{
va1.txt="Oktober"
}else if(rtc1==11)
{
va1.txt="November"
}else if(rtc1==12)
{
va1.txt="Dezember"
}
va0.txt+=va1.txt
va0.txt+=" "
// year
covx rtc0,va1.txt,0,0
va0.txt+=va1.txt
va0.txt+=" "
// hours
covx rtc3,va1.txt,2,0
va0.txt+=va1.txt
va0.txt+=":"
// minutes
covx rtc4,va1.txt,2,0
va0.txt+=va1.txt
va0.txt+=":"
// seconds
covx rtc5,va1.txt,2,0
va0.txt+=va1.txt
t_time.txt=va0.txt

22
code_excerpts/README.md Normal file
View file

@ -0,0 +1,22 @@
## code_excerpts
Okay, usually you go and look into the HMI files and get the code from there.
But, not everyone is a code so I spent another hour installing those nasty
Nextion editor (had to find out which versions works with these files since
I never touched those files since I created them back in 2019/2020/2021- I
really don't know when that was exactly...
So this folder exists only for one purpose: to let people get an idea of what
they have to work when trying to edit these files.
Also it might be easier to review the code in case I have to look at (parts of)
it again. (I hope not)
### Important / Wichtig
**Please, this code is far not complete**, it is an excerpt taken from the
HMI files and it only exists to have a place that can be referred without
having to download the HMI files and open them with the Nextion Editor.
Sidenote: I think I used the LTS version.

4
code_excerpts/info.txt Normal file
View file

@ -0,0 +1,4 @@
status codes and field names
https://github.com/WA6HXG/MMDVM-Nextion-Screen-Layouts/blob/master/Info%20Sheets/Status%20Codes%20and%20Fields.txt