Skip to content

Commit

Permalink
Debug slave eot
Browse files Browse the repository at this point in the history
  • Loading branch information
icarosadero committed Oct 1, 2023
1 parent c7f37bf commit 128f29c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyduino/slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def connect(self, delay: float = STEP):
delay (float, optional): Delay in seconds before sending the initial command.
"""
sleep(HEADER_DELAY)
self._recv(delay)
self._recv()
self._send("quiet_connect")
self.connected = True

Expand Down
48 changes: 43 additions & 5 deletions reactors/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Setup Arduino Environment
- name: Install Pyduino Parallel
hosts: reactors
become: yes
gather_facts: yes
Expand All @@ -8,7 +8,7 @@
prompt: "GitHub Token"
private: true
vars:
library_version: 0.1
library_version: master

tasks:
- name: Ensure required packages are installed
Expand All @@ -20,11 +20,12 @@
- unzip
- python3
- python3-pip
- python3-pandas
when: ansible_os_family == 'Debian'

- name: Download repository
get_url:
url: https://github.com/fotobiolab-unb/pyduino-parallel/archive/v{{ library_version }}.zip
url: https://github.com/fotobiolab-unb/pyduino-parallel/archive/{{ library_version }}.zip
dest: /home/pi/pyduino-parallel.zip
headers:
Authorization: "token {{ GH_TOKEN }}"
Expand All @@ -35,6 +36,7 @@

- name: Delete folder if exists
file:
remote_src: yes
path: /home/pi/pyduino-parallel
state: absent

Expand All @@ -47,18 +49,54 @@
- name: Renaming folver
command: mv /home/pi/pyduino-parallel-{{ library_version }} /home/pi/pyduino-parallel

- name: Make Writeable
file:
path: /home/pi/pyduino-parallel
mode: 0777
recurse: yes

- name: Install Python Libraries
command: pip3 install -r /home/pi/pyduino-parallel/requirements.txt
block:

- name: Install requirements
command: pip3 install -r /home/pi/pyduino-parallel/requirements.txt

- name: Moving unit file to Systemd
block:

- name: Delete file if exists
file:
remote_src: yes
path: /etc/systemd/system/pyduino.service
state: absent

- name: Copy file
copy:
remote_src: yes
src: /home/pi/pyduino-parallel/reactors/pyduino.service
dest: /etc/systemd/system/pyduino.service
dest: /etc/systemd/system/pyduino.service

- name: Deploying and Testing
block:

- name: Daemon Reload
shell: systemctl daemon-reload

- name: Enable Service
shell: systemctl enable pyduino.service

- name: Start Service
shell: systemctl start pyduino.service

- name: Wait for Service
wait_for:
port: 5000
delay: 5
timeout: 500

- name: GET port 5000
uri:
url: http://localhost:5000
method: GET
return_content: yes
register: result

0 comments on commit 128f29c

Please sign in to comment.