Skip to content

Commit

Permalink
Use an internal device in /tmp if VIRTUALDEVICE is an empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
pfichtner committed Feb 1, 2025
1 parent a9f1070 commit da8f76a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ For a complete python gherkin example see https://github.com/pfichtner/virtualav
![virtualavr.png](docs/images/virtualavr.png)

# Todos
- Add support for running simulator without VIRTUALDEVICE (VIRTUALDEVICE="")
- Provide Java Bindings as maven artefacts
- Add an example (jest?): How to test firmware, e.g. firmware reading DHT22 values and writing infos/warnings to console/SSD1306
- We could use WS also to load firmware
Expand Down
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ cd /sketch
FILENAME=${FILENAME:-'sketch.ino'}
BAUDRATE=${BAUDRATE:-9600}

# Create a temporary file if VIRTUALDEVICE is explicitly set to an empty string
[ -v VIRTUALDEVICE ] && [ -z "$VIRTUALDEVICE" ] && VIRTUALDEVICE=$(mktemp /tmp/virtualavrXXXX)

socat ${VERBOSITY:-} pty,rawer,link=${VIRTUALDEVICE:-'/dev/virtualavr0'},user=${DEVICEUSER:-'root'},group=${DEVICEGROUP:-'dialout'},mode=${DEVICEMODE:-660},b$BAUDRATE EXEC:"node /app/virtualavr.js $FILENAME",pty,rawer,fdin=3,fdout=4

0 comments on commit da8f76a

Please sign in to comment.