***DVSP2でPi-Star [#j5c22976] DVSP2_on_Rpi-Zero(V1.3)+OLED(128x64)にPi-Starのイメージ(v3.4.5)を一部改変して動くようにした。また以下機能追加。 ・ローカルUS-SRUST系レピーターに接続できるように ・OLEDによるヘッダーとショートメッセージ情報を表示できるように ・参考:http://www.pistar.uk/downloads/ ・必須事項:ショートメッセージを表示させるためには、DStarRepeater by mkagawa の パッケージを導入(make and install)して、いくつかの起動スクリプトの修正が必要です。 +serviceの停止((DVSP2なのでDMR/P25/YSFは利用できないので)) rootの権限で systemctl stop dmrgateway.timer systemctl disable dmrgateway.timer systemctl stop dmrgateway.service systemctl disable dmrgateway.service systemctl stop ysfgateway.timer systemctl disable ysfgateway.timer systemctl stop ysfgateway.service systemctl disable ysfgateway.service systemctl stop pistar-upnp.timer systemctl disable pistar-upnp.timer systemctl stop pistar-upnp.service systemctl disable pistar-upnp.service systemctl stop p25gateway.timer systemctl disable p25gateway.timer systemctl stop p25gateway.service systemctl disable p25gateway.service systemctl stop p25parrot.timer systemctl disable p25parrot.timer systemctl stop p25parrot.services systemctl disable p25parrot.services systemctl stop ysfparrot.timer systemctl disable ysfparrot.timer systemctl stop ysfparrot.service systemctl disable ysfparrot.service systemctl stop mmdvmhost.timer systemctl disable mmdvmhost.timer systemctl stop mmdvmhost.service systemctl disable mmdvmhost.service syssystemctl stop minissdpd.service systemtemctl disable minissdpd.service +ノードタイプの選択(Configuration画面) &ref(node_type.JPG,,60%); +ircddbgateway設定(expert→ircddbgateway画面) &ref(dplus_login.JPG,,60%); +PHP編集 # nano /var/www/dashboard/admin/dstarrepeater/link_manager.php while (!feof($dplusFile)) { $dplusLine = fgets($dplusFile); if (strpos($dplusLine, 'REF') !== FALSE && strpos($dplusLine, '#') === FALSE) { ↓ while (!feof($dplusFile)) { $dplusLine = fgets($dplusFile); if ((strpos($dplusLine, 'JP1') !== FALSE || strpos($dplusLine, 'REF') !== FALSE) && strpos($dplusLine, '#') === FALSE) { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^追加 *カッコも忘れないように ------------------------------------------ # nano /var/www/dashboard/admin/admin.php while (!feof($dplusFile)) { $dplusLine = fgets($dplusFile); if (strpos($dplusLine, 'REF') !== FALSE && strpos($dplusLine, '#') === FALSE && strpos($dplusLine, 'REF001') === FALSE) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 削除 ↓ while (!feof($dplusFile)) { $dplusLine = fgets($dplusFile); if (strpos($dplusLine, '#') === FALSE) && strpos($dplusLine, '#') === FALSE && strpos($dplusLine, 'REF001') === FALSE) +DPlus_Local.txtを作成・追加 #nano /usr/local/etc/DPlus_Local.txt JP1YJQ jp1yjq.xxx.yy ← ドメインまたはIPアドレス、デリミタは必ずタブのみにする JP1YKM jp1ykm.xxx.yy ← ドメインまたはIPアドレス、デリミタは必ずタブのみにする ----------------------- # nano /root/addlocal.sh "!/bin/bash cat /usr/local/etc/DPlus_Local.txt >> /usr/local/etc/DPlus_Hosts.txt pkill ircddbgatewayd sleep 2 /usr/local/bin/ircddbgatewayd -daemon を作成して、 # chmod 755 addlocal.sh と実行権を付与しておき、夜中3時過ぎに、新しい各種Hosts.txtがロードされ更新されてしまうので、 # crontab -e 0 4 * * * /root/addlocal.sh として毎日4時に、Hostsファイルを追加し、ircddbgatewaydを再起動して読み込ませる。 +他のcronでの自動起動を制限(コメントアウトしておく) # nano /etc/crontab # m h dom mon dow user command #*/5 * * * * root /usr/local/sbin/pistar-upnp.service start > /dev/null 2>&1 # 17 * * * * root cd / && run-parts --report /etc/cron.hourly +cronを再起動(念のため) # /etc/init.d/cron restart +OLEDへの表示 --- /root/lcdx.py ---- #!/usr/bin/python #-*- coding:utf-8 -*- #import RPi.GPIO as GPIO import re import subprocess import json from datetime import datetime from oled import OLED from oled import Font from oled import Graphics import sys import time # Connect to the display on /dev/i2c-1 dis = OLED(1) # Start communication dis.begin() # Start basic initialization dis.initialize() # Do additional configuration dis.set_memory_addressing_mode(0) dis.set_column_address(0, 127) dis.set_page_address(0, 7) dis.set_inverse_display(0) #dis.set_memory_addressing_mode(1) # Clear display dis.clear() dis.deactivate_scroll() # Set font scale x2 f = Font(2) #from time import time, asctime, sleep, localtime #def main(): while True: msg = "" station = "" cmd = "tail -500 /var/log/pi-star/dstarrepeaterd.log | grep -e 'Slow' | tail -1 | cut -c43-61" LastLink = subprocess.check_output(cmd, shell = True ) LastLink = LastLink.replace("Linked to", "") NowDT = datetime.now().strftime("%H:%M") cmd = "grep R_ShortMsg /var/log/pi-star/dstarrepeaterd.log | tail -1 | cut -c25-" RSM = subprocess.check_output(cmd, shell = True ) m = json.loads(RSM) if m and m['R_ShortMsg']: match = m['R_ShortMsg'] station = match['station'].strip() suffix = match['suffix'].strip() msg = match['msg'].strip() msg = msg.replace("/", " ") if msg == '' or msg == '_' or "Not" in msg or "It is" in msg: msg = NowDT + str.strip(LastLink) pm1 = str(station) pm2 = str(msg[0:5]) if "Linked" in msg: pm3 = str(msg[6:15]) else: pm3 = str(msg[5:14]) dis.clear() f.scale = 2 f.print_string(0, 0, pm1) f.print_string(0, 20, pm2) f.print_string(0, 36, pm3) dis.update() else: pm1 = str(station) pm2 = str(msg[0:9]) if "Linked" in msg: pm3 = str(msg[10:18]) else: pm3 = str(msg[5:14]) dis.clear() f.scale = 2 f.print_string(0, 0, pm1) f.print_string(0, 20, pm2) f.print_string(0, 36, pm3) dis.update() else: pm1 = str(station) pm2 = str(msg[0:9]) if "Linked" in msg: pm3 = str(msg[10:18]) else: pm3 = str(msg[9:18]) dis.clear() f.scale = 2 f.print_string(0, 0, pm1) f.print_string(0, 20, pm2) f.print_string(0, 36, pm3) dis.update() time.sleep(4.1) if __name__ == "__main__": try: main() except KeyboardInterrupt: pass finally: print "Goodbye!" ------------------------- 確認のため # /root/lcdx.py & と、常駐起動して動作確認。OKであれば、/etc/rc.local に追加しておく。 +表示例 例-1 接続なく待機中の場合 例-2 ノードが接続先へ接続した時 ノードコール/現在の時刻/接続状態 ノードコール/接続状態/接続先 &ref(IMG_2624.JPG,,50%); &ref(IMG_2629.JPG,,50%); 例-3 アクセス局にメッセージが無い場合 例-4 アクセス局にメッセージがある場合 アクセスコール/現在時刻/接続先 アクセスコール/ショートメッセージ(2行) &ref(IMG_2631.JPG,,50%); &ref(IMG_2639.JPG,,50%); 例-5 アクセス局にメッセージがある場合 例-6 接続後誰もアクセスなしの場合 アクセスコール/ショートメッセージ(2行) ノードコール/現在時刻/接続先 &ref(IMG_2641.JPG,,50%); &ref(IMG_2644.JPG,,50%); #clear #comment #navi(日記) |