Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Benhalor committed Mar 28, 2024
1 parent 253b6a8 commit 7888eb5
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
Empty file modified flash.sh
100755 → 100644
Empty file.
Empty file modified scripts/compile_and_dfu_hardware_v3.sh
100755 → 100644
Empty file.
Empty file modified scripts/compile_and_flash.sh
100755 → 100644
Empty file.
Empty file modified scripts/compile_only.sh
100755 → 100644
Empty file.
3 changes: 1 addition & 2 deletions srcs/pc_cmv_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,13 @@ void PC_CMV_Controller::inhale() {

void PC_CMV_Controller::exhale() {
// Close the inspiratory valve
inspiratoryValve.open(VALVE_CLOSED_STATE-PCexpiratoryPID(mainController.pressureCommand(),
inspiratoryValve.open(-PCexpiratoryPID(mainController.pressureCommand(),
mainController.pressure(), mainController.dt()));

// Open the expiratos valve so the patient can exhale outside
// expiratoryValve.open(PCexpiratoryPID(mainController.pressureCommand(),
// mainController.pressure(), mainController.dt()));
}

void PC_CMV_Controller::endCycle() { calculateBlowerIncrement(); }

void PC_CMV_Controller::calculateBlowerIncrement() {
Expand Down
21 changes: 15 additions & 6 deletions srcs/pressure_valve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

// Internal libraries
#include "../includes/parameters.h"
#include "Arduino.h"

// INITIALISATION =============================================================

PressureValve expiratoryValve;
PressureValve inspiratoryValve;

Expand Down Expand Up @@ -145,21 +145,30 @@ void PressureValve::openSection(int32_t p_sectionMultiplyBy100) {
}

void PressureValve::execute() {

// Position milieu - les deux vannes sont ouvertes
int Pos_dxl_valve_open = 2048 ;
// Position vanne expiratoire fermée
int Pos_dxl_exp_valve_closed = 2300;
// Position vanne insipratoire fermée
int Pos_dxl_insp_valve_closed = 1800;

// On évite d'aller plus loin que les limites de la valve
if (command < minApertureAngle) {
command = minApertureAngle;
} else if (command > maxApertureAngle) {
if (command > maxApertureAngle) {
command = maxApertureAngle;
} else {
}
else {
}

if (command != position) {
//Serial.println((4095*(position-maxApertureAngle))/(maxApertureAngle-minApertureAngle));
dxl_Position((4095*(position-minApertureAngle))/(maxApertureAngle-minApertureAngle));
dxl_Position(Pos_dxl_valve_open+((Pos_dxl_exp_valve_closed-Pos_dxl_valve_open)*position/maxApertureAngle));
position = command;
}
}



void PressureValve::open() { command = openApertureAngle; }

void PressureValve::close() { command = closeApertureAngle; }
Expand Down
2 changes: 1 addition & 1 deletion srcs/srcs.ino
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
HardwareTimer* hardwareTimer1; // ESC command
HardwareTimer* hardwareTimer3; // valves command

HardwareSerial Serial6(PIN_TELEMETRY_SERIAL_RX, PIN_TELEMETRY_SERIAL_TX);
HardwareSerial Serial6(PIN_TELEMETRY_SERIAL_RX, PIN_TELEMETRY_SERIAL_TX);
HardwareSerial Serial7(PC6);

void setup(void) {
Expand Down

0 comments on commit 7888eb5

Please sign in to comment.