Compare commits
No commits in common. "363e2426540fbb0700faf8b196cd34231e18474e" and "2aff11395cf91908a98b0e3c3cc5ffc24e78bc77" have entirely different histories.
363e242654
...
2aff11395c
6 changed files with 23 additions and 77 deletions
3
.env
3
.env
|
@ -9,6 +9,3 @@ SERIAL_SPEED=9600
|
|||
|
||||
# FIFO filename
|
||||
FIFO="/tmp/mapid"
|
||||
|
||||
# fifo_bridge.py PID file
|
||||
FIFO_BRIDGE_PID_FILE="/tmp/mapid_fifo_bridge.pid"
|
|
@ -72,11 +72,3 @@ PHP based Web interface for `fifo_bridge.py` supporting all commands of *MAPID/C
|
|||
### `notification.sh`
|
||||
|
||||
Use the LED and display to show a notification, the purpose of the whole MAPID project.
|
||||
|
||||
## Links
|
||||
|
||||
- [My blog post about MAPID (German)](https://malte70.de/blog/mapid/)
|
||||
- Arduino libraries
|
||||
- [SerialCommand Advanced](https://github.com/shyd/Arduino-SerialCommand)
|
||||
- [serLCD](http://playground.arduino.cc/Code/SerLCD)
|
||||
|
||||
|
|
|
@ -9,10 +9,7 @@ if (!file_exists(FIFO))
|
|||
|
||||
$f = fopen(FIFO, "w+");
|
||||
|
||||
if (count($_POST) == 0)
|
||||
$_POST = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
switch (@$_POST["cmd"]) {
|
||||
switch ($_POST["cmd"]) {
|
||||
case "getty":
|
||||
fwrite($f, "GETTY");
|
||||
break;
|
||||
|
@ -39,16 +36,6 @@ switch (@$_POST["cmd"]) {
|
|||
fwrite($f, "ECHO ");
|
||||
fwrite($f, $_POST["text"]);
|
||||
break;
|
||||
case "echo2":
|
||||
fwrite($f, "CLS\n");
|
||||
fwrite($f, "LINE 1\n");
|
||||
fwrite($f, "ECHO ");
|
||||
fwrite($f, $_POST["line1"]);
|
||||
fwrite($f, "\n");
|
||||
fwrite($f, "LINE 2\n");
|
||||
fwrite($f, "ECHO ");
|
||||
fwrite($f, $_POST["line2"]);
|
||||
break;
|
||||
}
|
||||
|
||||
fwrite($f, "\n");
|
||||
|
|
|
@ -15,21 +15,18 @@ $Title = "MAPID-FIFO Web-UI";
|
|||
</header>
|
||||
<main>
|
||||
<section>
|
||||
<h3>Welcome message</h3>
|
||||
<form action="command.php" method="POST">
|
||||
<input type="hidden" name="cmd" value="getty">
|
||||
<button type="submit">Getty</button>
|
||||
</form>
|
||||
</section>
|
||||
<section>
|
||||
<h3>Clear screen</h3>
|
||||
<form action="command.php" method="POST">
|
||||
<input type="hidden" name="cmd" value="cls">
|
||||
<button type="submit">Clear</button>
|
||||
</form>
|
||||
</section>
|
||||
<section>
|
||||
<h3>Control LED</h3>
|
||||
<form action="command.php" method="POST">
|
||||
<input type="hidden" name="cmd" value="on">
|
||||
<button type="submit">LED On</button>
|
||||
|
@ -40,7 +37,6 @@ $Title = "MAPID-FIFO Web-UI";
|
|||
</form>
|
||||
</section>
|
||||
<section>
|
||||
<h3>Control display</h3>
|
||||
<form action="command.php" method="POST">
|
||||
<input type="hidden" name="cmd" value="lcdon">
|
||||
<button type="submit">Display On</button>
|
||||
|
@ -51,7 +47,6 @@ $Title = "MAPID-FIFO Web-UI";
|
|||
</form>
|
||||
</section>
|
||||
<section>
|
||||
<h3>Line selection for output</h3>
|
||||
<form action="command.php" method="POST">
|
||||
<input type="hidden" name="cmd" value="line">
|
||||
<select name="line" height="1">
|
||||
|
@ -62,22 +57,12 @@ $Title = "MAPID-FIFO Web-UI";
|
|||
</form>
|
||||
</section>
|
||||
<section>
|
||||
<h3>Single line output</h3>
|
||||
<form action="command.php" method="POST">
|
||||
<input type="hidden" name="cmd" value="echo">
|
||||
<input type="text" name="text" placeholder="Text">
|
||||
<button type="submit">Output</button>
|
||||
</form>
|
||||
</section>
|
||||
<section>
|
||||
<h3>Multi line output</h3>
|
||||
<form action="command.php" method="POST">
|
||||
<input type="hidden" name="cmd" value="echo2">
|
||||
<input type="text" name="line1" placeholder="Text line 1"><br>
|
||||
<input type="text" name="line2" placeholder="Text line 2">
|
||||
<button type="submit">Output</button>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
<p><a href="https://git.un-hack-bar.de/malte70/mapid">mapid Git-Repo</a></p>
|
||||
|
|
|
@ -29,36 +29,35 @@ input, select {
|
|||
border-radius: 6px;
|
||||
padding: 6px 14px;
|
||||
|
||||
/*background: #DFDEDF;*/
|
||||
background: #efefef;
|
||||
/*box-shadow: 0px 0.5px 1px rgba(0, 0, 0, 0.1), inset 0px 0.5px 0.5px rgba(255, 255, 255, 0.5), 0px 0px 0px 0.5px rgba(0, 0, 0, 0.12);*/
|
||||
color: #6E6D70;
|
||||
display: inline-block;
|
||||
margin-right: .5em;
|
||||
margin-bottom: .5em;
|
||||
/*background: #DFDEDF;*/
|
||||
background: #efefef;
|
||||
/*box-shadow: 0px 0.5px 1px rgba(0, 0, 0, 0.1), inset 0px 0.5px 0.5px rgba(255, 255, 255, 0.5), 0px 0px 0px 0.5px rgba(0, 0, 0, 0.12);*/
|
||||
color: #6E6D70;
|
||||
display: inline-block;
|
||||
margin-right: .5em;
|
||||
}
|
||||
|
||||
/* https://getcssscan.com/css-buttons-examples */
|
||||
button {
|
||||
/*display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;*/
|
||||
padding: 6px 14px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
|
||||
border-radius: 6px;
|
||||
border: none;
|
||||
|
||||
background: #6E6D70;
|
||||
box-shadow: 0px 0.5px 1px rgba(0, 0, 0, 0.1), inset 0px 0.5px 0.5px rgba(255, 255, 255, 0.5), 0px 0px 0px 0.5px rgba(0, 0, 0, 0.12);
|
||||
color: #DFDEDF;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
touch-action: manipulation;
|
||||
/*display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;*/
|
||||
padding: 6px 14px;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
|
||||
border-radius: 6px;
|
||||
border: none;
|
||||
|
||||
background: #6E6D70;
|
||||
box-shadow: 0px 0.5px 1px rgba(0, 0, 0, 0.1), inset 0px 0.5px 0.5px rgba(255, 255, 255, 0.5), 0px 0px 0px 0.5px rgba(0, 0, 0, 0.12);
|
||||
color: #DFDEDF;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
touch-action: manipulation;
|
||||
}
|
||||
|
||||
button:focus {
|
||||
box-shadow: inset 0px 0.8px 0px -0.25px rgba(255, 255, 255, 0.2), 0px 0.5px 1px rgba(0, 0, 0, 0.1), 0px 0px 0px 3.5px rgba(58, 108, 217, 0.5);
|
||||
outline: 0;
|
||||
box-shadow: inset 0px 0.8px 0px -0.25px rgba(255, 255, 255, 0.2), 0px 0.5px 1px rgba(0, 0, 0, 0.1), 0px 0px 0px 3.5px rgba(58, 108, 217, 0.5);
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
|
|
|
@ -16,32 +16,20 @@ def main():
|
|||
if len(sys.argv) == 2:
|
||||
FIFO = sys.argv[1]
|
||||
|
||||
# Write PID
|
||||
FIFO_BRIDGE_PID_FILE = os.environ.get("FIFO_BRIDGE_PID_FILE")
|
||||
f = open(FIFO_BRIDGE_PID_FILE, "w")
|
||||
f.write(os.getpid())
|
||||
f.close()
|
||||
del f
|
||||
|
||||
# Create MAPIDCP object to communicate with the Arduino
|
||||
m = mapid.MAPIDCP()
|
||||
|
||||
# Create FIFO
|
||||
os.mkfifo(FIFO)
|
||||
time.sleep(0.2)
|
||||
print("Created FIFO " + FIFO, file=sys.stderr)
|
||||
|
||||
f = open(FIFO, "r")
|
||||
print("Opened FIFO for reading", file=sys.stderr)
|
||||
|
||||
# Show greeting on screen
|
||||
m.cls()
|
||||
m.line(1)
|
||||
m.echo("fifo_bridge.py")
|
||||
m.line(2)
|
||||
m.echo(FIFO)
|
||||
|
||||
# Main loop: read commands from FIFO and execute it
|
||||
keep_going = True
|
||||
while keep_going:
|
||||
try:
|
||||
|
@ -54,9 +42,7 @@ def main():
|
|||
keep_going = False
|
||||
print("Caught a SerialException. Exiting now...", file=sys.stderr)
|
||||
|
||||
# Remove FIFO and PID files
|
||||
os.remove(FIFO)
|
||||
os.remove(FIFO_BRIDGE_PID_FILE)
|
||||
print("Removed FIFO.", file=sys.stderr)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue