forked from OpenVoiceOS/ovos-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request OpenVoiceOS#79 from OpenVoiceOS/feat/support_mark1
Add support for Mycroft Mark 1 device
- Loading branch information
Showing
19 changed files
with
280 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# ovos_hardware_mark1 | ||
|
||
Setup the atmega328p Arduino chip running on the Mark 1 device. | ||
|
||
## License | ||
|
||
Apache 2 | ||
|
||
## Author Information | ||
|
||
Gaëtan Trellu - @goldyfruit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/env bash | ||
# | ||
# This script initialiaze the atmega328p chip from the Mark 1 device. | ||
# Once initialized the eyes color will be changed to yellow and | ||
# the mouth text will display "booting". | ||
# As final action, if the sndrpiproto soundcard is detected then | ||
# it will be configured. | ||
|
||
# Variables | ||
eyes_color="16760576" | ||
mouth_text="booting" | ||
tty_device=/dev/ttyAMA0 | ||
alsa_card="sndrpiproto" | ||
alsa_configured=/opt/mark1/alsa.configured | ||
|
||
# Initialiaze the firmware and wait two seconds | ||
avrdude -p atmega328p -c linuxgpio -U signature:r:-:i -F | ||
sleep 2 | ||
|
||
# Set eyes color | ||
echo "eyes.color=$eyes_color" > "$tty_device" | ||
|
||
# Set mouth text | ||
echo "mouth.text=$mouth_text" > "$tty_device" | ||
|
||
# Set default values to sndrpiproto ALSA card | ||
if grep "$alsa_card" /proc/asound/cards -q; then | ||
# Set volume mixer only once | ||
if [ ! -f "$alsa_configured" ]; then | ||
amixer -c "$alsa_card" cset numid=1 100,100 | ||
touch "$alsa_configured" | ||
fi | ||
amixer -c "$alsa_card" cset numid=2 on | ||
amixer -c "$alsa_card" cset numid=6 on | ||
amixer -c "$alsa_card" cset numid=10 on | ||
amixer -c "$alsa_card" cset numid=14 1 | ||
amixer -c "$alsa_card" cset numid=13 on | ||
amixer -c "$alsa_card" cset numid=9 on | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
- name: Reload Systemd User | ||
become: true | ||
become_user: "{{ ovos_installer_user }}" | ||
ansible.builtin.systemd_service: | ||
daemon_reload: true | ||
scope: user | ||
|
||
- name: Set Reboot | ||
ansible.builtin.set_fact: | ||
ovos_installer_reboot: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
galaxy_info: | ||
author: Gaëtan trellu (@goldyfruit) | ||
description: Open Voice OS installer Mark 1 | ||
company: Smart'Gic | ||
standalone: true | ||
|
||
issue_tracker_url: https://github.com/openvoiceos/ovos-installer/issues | ||
|
||
license: Apache-2.0 | ||
|
||
min_ansible_version: "2.12" | ||
|
||
platforms: | ||
- name: Debian | ||
versions: | ||
- bookworm | ||
- bullseye | ||
|
||
galaxy_tags: | ||
- openvoiceos | ||
- ovos | ||
- hivemind | ||
- voiceassistant | ||
- mark1 | ||
- atmega328p | ||
|
||
dependencies: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
- name: Check for /boot/firmware directory | ||
ansible.builtin.stat: | ||
path: /boot/firmware | ||
register: _boot_config_status | ||
|
||
- name: Set _boot_directory fact | ||
ansible.builtin.set_fact: | ||
_boot_directory: "{{ '/boot/firmware' if _boot_config_status.stat.exists | bool else '/boot' }}" | ||
|
||
- name: Manage TTY and soundcard overlays | ||
ansible.builtin.lineinfile: | ||
path: /boot/firmware/config.txt | ||
regexp: "^{{ item }}" | ||
line: "{{ item }}" | ||
notify: Set Reboot | ||
loop: | ||
- dtoverlay=miniuart-bt | ||
- dtoverlay=proto-codec | ||
|
||
- name: Disable snd_bcm2835 audio interface | ||
ansible.builtin.lineinfile: | ||
path: "{{ _boot_directory }}/config.txt" | ||
regexp: "^{{ item.key }}=" | ||
line: "{{ item.key }}={{ item.value }}" | ||
notify: Set Reboot | ||
loop: | ||
- { key: "dtparam=audio", value: "off" } | ||
|
||
- name: Redirect console to tty1 only | ||
ansible.builtin.replace: | ||
path: "{{ _boot_directory }}/cmdline.txt" | ||
regexp: '\bconsole=serial0,115200\b\s?' | ||
replace: "" | ||
notify: Set Reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- name: Include prepare.yml | ||
ansible.builtin.import_tasks: prepare.yml | ||
|
||
- name: Include config.yml | ||
ansible.builtin.import_tasks: config.yml | ||
|
||
- name: Include service.yml | ||
ansible.builtin.import_tasks: service.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
- name: Add {{ ovos_installer_user }} to dialout group | ||
ansible.builtin.user: | ||
name: "{{ ovos_installer_user }}" | ||
groups: dialout | ||
append: true | ||
|
||
- name: Create directories | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
owner: "{{ ovos_installer_user }}" | ||
group: "{{ ovos_installer_user }}" | ||
mode: "0755" | ||
loop: | ||
- "{{ ovos_installer_user_home }}/.config/systemd/user" | ||
- "{{ _ovos_hardware_mark1_workind_directory }}" | ||
|
||
- name: Configure initialize.sh to {{ _ovos_hardware_mark1_workind_directory }} | ||
ansible.builtin.copy: | ||
src: initialize.sh | ||
dest: "{{ _ovos_hardware_mark1_workind_directory }}/initialize.sh" | ||
owner: "{{ ovos_installer_user }}" | ||
group: "{{ ovos_installer_user }}" | ||
mode: "0755" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
- name: Copy mark1 systemd unit file | ||
ansible.builtin.template: | ||
src: mark1.service.j2 | ||
dest: "{{ ovos_installer_user_home }}/.config/systemd/user/mark1.service" | ||
owner: "{{ ovos_installer_user }}" | ||
group: "{{ ovos_installer_user }}" | ||
mode: "0644" | ||
notify: Reload Systemd User | ||
|
||
- name: Flush handlers service | ||
ansible.builtin.meta: flush_handlers | ||
|
||
- name: Enable mark1 systemd unit | ||
become: true | ||
become_user: "{{ ovos_installer_user }}" | ||
ansible.builtin.systemd_service: | ||
name: mark1.service | ||
enabled: true | ||
force: true | ||
scope: user |
15 changes: 15 additions & 0 deletions
15
ansible/roles/ovos_hardware_mark1/templates/mark1.service.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[Unit] | ||
Documentation=https://github.com/MycroftAI/enclosure-mark1 | ||
Description=Mycroft Mark 1's atmega328p initialization | ||
After=network-online.target | ||
ConditionPathExists=/dev/ttyAMA0 | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/opt/mark1/initialize.sh | ||
Restart=on-failure | ||
RestartSec=5s | ||
RemainAfterExit=yes | ||
|
||
[Install] | ||
WantedBy=default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
_ovos_hardware_mark1_avrdude_binary: /usr/local/bin/avrdude | ||
_ovos_hardware_mark1_workind_directory: /opt/mark1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters