Commit 6b643141 authored by Derick's avatar Derick

use spare pin 2 to indicate to NI DAQ that the embedded system detected a spontaneous breath

parent 9cdd43f8
Pipeline #850 failed with stages
in 0 seconds
---
# © Copyright CERN, Riga Technical University and University of Liverpool 2020.
# All rights not expressly granted are reserved.
#
# This file is part of hev-sw.
#
# hev-sw is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public Licence as published by the Free
# Software Foundation, either version 3 of the Licence, or (at your option)
# any later version.
#
# hev-sw is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Licence
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with hev-sw. If not, see <http://www.gnu.org/licenses/>.
#
# The authors would like to acknowledge the much appreciated support
# of all those involved with the High Energy Ventilator project
# (https://hev.web.cern.ch/).
- hosts: hevpi
remote_user: pi
vars:
download_dir: /home/pi/Downloads
repos:
- hev
tasks:
- name: include vars
include_vars: lists.yml
- name: apt update, apt upgrade
apt:
upgrade: yes
update_cache: yes
become: yes
- name: install software via apt
apt:
name: "{{ rpi_swlist }}"
state: latest
become: yes
- name: mk sw dir
file:
path: /home/pi/sw/bin
state: directory
- name: link libts
file:
src: "/usr/lib/arm-linux-gnueabihf/libts.so.0"
dest: "/usr/lib/arm-linux-gnueabihf/libts-0.0.so.0"
state: link
become: yes
- name: Adding user pi to www-data
user:
name: pi
groups: www-data
append: yes
become: yes
- name: install hevconf into apache
copy:
src: "{{ ansible_env.HOME }}/hev/raspberry-backend/share/hev.conf"
dest: "/etc/apache2/sites-available/hev.conf"
remote_src: yes
become: yes
- name: setup apache
command: "{{ download_dir }}/setup_apache.sh"
become: yes
......@@ -613,7 +613,7 @@ void BreathingLoop::FSM_breathCycle()
_pid.istep = 0;
_peep = _running_avg_peep;
digitalWrite(pin_spare_2, LOW);
break;
case BL_STATES::INHALE:
//_valves_controller.setValves(VALVE_STATE::CLOSED, VALVE_STATE::CLOSED, VALVE_STATE::OPEN, VALVE_STATE::CLOSED, VALVE_STATE::CLOSED);//Comment this line for the PID control during inhale
......@@ -662,7 +662,8 @@ void BreathingLoop::FSM_breathCycle()
}
//logMsg("exhale "+String(_peak_flow_time)+" "+_measured_durations.inhale+ " "+_measured_durations.exhale+" " +_fsm_timeout);
measurePEEP();
digitalWrite(pin_led_red, LOW);
digitalWrite(pin_led_red, LOW);
digitalWrite(pin_spare_2, LOW);
_mandatory_inhale = inhaleTrigger();
_pressure_buffer_fitter.resetCalculation(_peak_flow_time);
_pressure_patient_fitter.resetCalculation(_peak_flow_time);
......@@ -1146,10 +1147,11 @@ bool BreathingLoop::inhaleTrigger()
//logMsg(" -- INHALE TRIGGER " +String(millis()) + String("Exp. Flow: ") + String(expected_flow) + String(" Difference: ") + String(_flow - expected_flow));
//logMsg(" -- INHALE TRIGGER " +String(millis()) );//+ String("Exp. Flow: ") + String(expected_flow) + String(" Difference: ") + String(_flow - expected_flow));
result = " -- INHALE TRIGGER" ;
_fsm_timeout = 0; // go to next state immediately
// _fsm_timeout = 0; // go to next state immediately
_apnea_event = false;
_inhale_triggered = true;
digitalWrite(pin_led_red, HIGH);
digitalWrite(pin_led_red, HIGH);
digitalWrite(pin_spare_2, HIGH);
return false;
}
// logMsg("D " + String(expected_flow) +" "+String(_flow));
......
......@@ -103,6 +103,9 @@ void setup()
pinMode(pin_led_yellow, OUTPUT);
pinMode(pin_led_red, OUTPUT);
pinMode(pin_spare_2,OUTPUT);
digitalWrite(pin_spare_2,LOW);
//pinMode(pin_buzzer, OUTPUT);
comms.beginSerial();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment