mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 13:17:50 +02:00
Add support for containers and simulation
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -130,3 +130,4 @@ dmypy.json
|
|||||||
|
|
||||||
*.swp
|
*.swp
|
||||||
dcc/media
|
dcc/media
|
||||||
|
arduino/CommandStation-EX/build/
|
||||||
|
8
daemons/Dockerfile
Normal file
8
daemons/Dockerfile
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
FROM python:3.10-alpine
|
||||||
|
|
||||||
|
RUN mkdir /opt/dcc && pip -q install pyserial
|
||||||
|
ADD net-to-serial.py config.ini /opt/dcc
|
||||||
|
|
||||||
|
EXPOSE 2560/tcp
|
||||||
|
|
||||||
|
CMD ["python3", "/opt/dcc/net-to-serial.py"]
|
1
daemons/net-to-serial.py
Normal file → Executable file
1
daemons/net-to-serial.py
Normal file → Executable file
@@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
import logging
|
import logging
|
||||||
import serial
|
import serial
|
||||||
import asyncio
|
import asyncio
|
||||||
|
BIN
daemons/simulator/CommandStation-EX-uno-00e3c80.elf
Normal file
BIN
daemons/simulator/CommandStation-EX-uno-00e3c80.elf
Normal file
Binary file not shown.
7
daemons/simulator/Dockerfile
Normal file
7
daemons/simulator/Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
FROM dcc/net-to-serial
|
||||||
|
|
||||||
|
RUN apk update && apk add qemu-system-avr && mkdir /io
|
||||||
|
ADD start.sh /opt/dcc
|
||||||
|
ADD CommandStation-EX-uno-*.elf /io
|
||||||
|
|
||||||
|
CMD ["/bin/sh", "/opt/dcc/start.sh"]
|
6
daemons/simulator/README.md
Normal file
6
daemons/simulator/README.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# AVR Simulator
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ podman build -t dcc/net-to-serial:sim .
|
||||||
|
$ podman run -d -p2560:2560 dcc/net-to-serial:sim
|
||||||
|
```
|
12
daemons/simulator/start.sh
Executable file
12
daemons/simulator/start.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
PTY=0
|
||||||
|
|
||||||
|
if [ -c /dev/pts/0 ]; then
|
||||||
|
PTY=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i "s/ttyACM0/pts\/${PTY}/" /opt/dcc/config.ini
|
||||||
|
|
||||||
|
qemu-system-avr -machine uno -bios /io/CommandStation-EX-uno-*.elf -serial pty -daemonize
|
||||||
|
/opt/dcc/net-to-serial.py
|
Reference in New Issue
Block a user