Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/texx00/sandypi
Browse files Browse the repository at this point in the history
  • Loading branch information
texx00 committed Jul 11, 2020
2 parents 437b60d + a4294c1 commit 94c6898
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion NCFeeder/feeder.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def _thf(self, code):
print("Starting new drawing with code {}".format(code))
with self.mutex:
code = self._running_code
filename = os.path.join(Path(__file__).parent.parent.absolute(), "UIserver/static/Drawings/{0}/{0}.gcode".format(code))
filename = os.path.join(str(Path(__file__).parent.parent.absolute()), "UIserver/static/Drawings/{0}/{0}.gcode".format(code))

# TODO retrieve saved information for the gcode filter
dims = {"table_x":100, "table_y":100, "drawing_max_x":100, "drawing_max_y":100, "drawing_min_x":0, "drawing_min_y":0}
Expand All @@ -154,6 +154,7 @@ def _thf(self, code):
with open(filename, "r") as file:
file_line = 1
for k, line in enumerate(file):
line = line.upper()
if not self.is_running():
break
while self.is_paused():
Expand Down
6 changes: 5 additions & 1 deletion NCFeeder/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
from pid import PidFile
from time import sleep
import traceback
import atexit

pidname = "feeder.pid2"

try:
with PidFile(pidname) as p: # check if the process is already running using pid files. If it is already running will restart it

sioif = SocketInterface()


@atexit.register
def at_exit():
sioif.at_exit()
# Wait for any event
while True:
pass
Expand Down
3 changes: 1 addition & 2 deletions NCFeeder/socketio_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ class SocketInterface():

def __init__(self):
sio.connect('http://127.0.0.1:5000')
atexit.register(self.at_exit)
print("Socket connection established")
events = FeederEvents()
self.feeder = Feeder(events)
sio.feeder = self.feeder
self.feeder.connect()

def at_exit():
def at_exit(self):
sio.feeder.close()
sio.disconnect()

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A python program to feed your automatic zen table with a fresh design everyday

## The idea

Zen tables are beautiful but I don't like to see always the same design on the sand: I wanted to have a fresh design waiting me every morning at caffee time.
Zen tables are beautiful but I don't like to see always the same design on the sand: I wanted to have a fresh design waiting me every morning at coffee time.

The program can run on a raspberry pi connected to your zen table and change the design over night.
You can control the drawings via the web interface from your device connected to the network (smartphone, tablet or computer independently thanks to the web interface).
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ python-engineio==3.13.0
python-socketio==4.6.0
PyYAML==5.3.1
requests==2.23.0
serial==0.0.97
setuptools==47.1.1
six==1.15.0
SQLAlchemy==1.3.17
Expand Down

0 comments on commit 94c6898

Please sign in to comment.