diff --git a/README.md b/README.md index 6b95c67..7d5bf98 100644 --- a/README.md +++ b/README.md @@ -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-04-27) +~~## 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 -│   ├── Multi-LH-DMR-NX8048K070_011.hmi +│   ├── linux +│   │   ├── dashboard +│   │   ├── hotspot +│   │   ├── index.txt +│   │   ├── README.md +│   │   └── shrinklog +│   ├── Multi-LH-DMR-NX8048K070_011.HMI │   ├── Multi-LH-DMR-NX8048K070_011.tft -│   ├── README.md -│   └── nxt07_01.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 ``` diff --git a/code_excerpts/24_S0.txt b/code_excerpts/24_S0.txt new file mode 100644 index 0000000..c3eeea7 --- /dev/null +++ b/code_excerpts/24_S0.txt @@ -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="" + } + } + } +} diff --git a/code_excerpts/70_DMR_PostInit.txt b/code_excerpts/70_DMR_PostInit.txt new file mode 100644 index 0000000..bb14ac2 --- /dev/null +++ b/code_excerpts/70_DMR_PostInit.txt @@ -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 +} diff --git a/code_excerpts/70_MMDVM_PreInit.txt b/code_excerpts/70_MMDVM_PreInit.txt new file mode 100644 index 0000000..db70c67 --- /dev/null +++ b/code_excerpts/70_MMDVM_PreInit.txt @@ -0,0 +1,6 @@ +bauds=115200 +//bauds=9600 +// get and set brightness +repo SYSTEM.va0.val,10 +dim=SYSTEM.va0.val +page DMR diff --git a/code_excerpts/70_S0.txt b/code_excerpts/70_S0.txt new file mode 100644 index 0000000..bee9fa6 --- /dev/null +++ b/code_excerpts/70_S0.txt @@ -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="" + } + } + } +} diff --git a/code_excerpts/70_SYSTEM_PreInit.txt b/code_excerpts/70_SYSTEM_PreInit.txt new file mode 100644 index 0000000..3c47a25 --- /dev/null +++ b/code_excerpts/70_SYSTEM_PreInit.txt @@ -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 diff --git a/code_excerpts/70_tm0.txt b/code_excerpts/70_tm0.txt new file mode 100644 index 0000000..f898b7a --- /dev/null +++ b/code_excerpts/70_tm0.txt @@ -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 diff --git a/code_excerpts/README.md b/code_excerpts/README.md new file mode 100644 index 0000000..f0f9e11 --- /dev/null +++ b/code_excerpts/README.md @@ -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. + diff --git a/code_excerpts/info.txt b/code_excerpts/info.txt new file mode 100644 index 0000000..c8c0795 --- /dev/null +++ b/code_excerpts/info.txt @@ -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 +