From fce951a70f5359457d5811b138d4fd546905d8df Mon Sep 17 00:00:00 2001 From: Nik Rozman Date: Mon, 24 Oct 2022 15:04:38 +0200 Subject: [PATCH] Add extras and build scripts --- build/arduino.avr.uno/extras/ser2net.conf | 4 ++++ .../extras/socat-remote.service | 19 +++++++++++++++++++ build/arduino.avr.uno/scripts/flash.sh | 10 ++++++++++ 3 files changed, 33 insertions(+) create mode 100644 build/arduino.avr.uno/extras/ser2net.conf create mode 100644 build/arduino.avr.uno/extras/socat-remote.service create mode 100644 build/arduino.avr.uno/scripts/flash.sh diff --git a/build/arduino.avr.uno/extras/ser2net.conf b/build/arduino.avr.uno/extras/ser2net.conf new file mode 100644 index 0000000..a488e1d --- /dev/null +++ b/build/arduino.avr.uno/extras/ser2net.conf @@ -0,0 +1,4 @@ +# /etc/ser2net.conf +# This file is part of the source device. + +2000:raw:600:/dev/ttyACM0:9600 8DATABITS NONE 1STOPBIT diff --git a/build/arduino.avr.uno/extras/socat-remote.service b/build/arduino.avr.uno/extras/socat-remote.service new file mode 100644 index 0000000..019ba7e --- /dev/null +++ b/build/arduino.avr.uno/extras/socat-remote.service @@ -0,0 +1,19 @@ +# This file is part of the Home Assistant server. + +[Unit] +Description=Socat bridge to ser2net +After=wg-quick@wg0.service +Requires=wg-quick@wg0.service + +[Service] +Type=simple +StandardOutput=syslog +StandardError=syslog +SyslogIdentifier=socat-bridge + +ExecStartPre=/usr/bin/rm -rf /dev/ttyV0 +ExecStart=/usr/bin/socat pty,link=/dev/ttyV0,waitslave tcp:10.10.0.2:2000 +Restart=always + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/build/arduino.avr.uno/scripts/flash.sh b/build/arduino.avr.uno/scripts/flash.sh new file mode 100644 index 0000000..bc8118f --- /dev/null +++ b/build/arduino.avr.uno/scripts/flash.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Stop ser2net to free serial port +service ser2net stop + +# Flash the firmware +avrdude -v -p m328p -F -P /dev/serial/by-id/usb-Arduino__www.arduino.cc__0043_95032303837351D02141-if00 -c arduino -D -U flash:w:../vremenska-postaja.ino.hex:i + +# Start ser2net +service ser2net start \ No newline at end of file