Kabuki Starship / Mbed 2 deprecated GHVentilator

Dependencies:   mbed SickBayTek

Revision:
10:09fe2b1474bf
Parent:
9:256989faeb3b
diff -r 256989faeb3b -r 09fe2b1474bf GHVentilator.hpp
--- a/GHVentilator.hpp	Fri Apr 10 11:56:58 2020 +0000
+++ b/GHVentilator.hpp	Sat Apr 11 08:48:28 2020 +0000
@@ -1,24 +1,24 @@
-/** Gravity Hookah Ventilator @version 0.x
+/** SickBay Tek @version 0.x
 @link    https://github.com/KabukiStarship/SickBay.git
-@file    /GHVentilaorChannel.cpp
+@file    /Firmware/Tek/SBVentilaorChannel.hpp
 @author  Cale McCollough <https://cale-mccollough.github.io>
 @license Copyright 2020 (C) Kabuki Starship <kabukistarship.com>.
 This Source Code Form is subject to the terms of the Mozilla Public License, 
 v. 2.0. If a copy of the MPL was not distributed with this file, you can obtain 
 one at <https://mozilla.org/MPL/2.0/>. */
 
-#include "GHVentilator.h"
-#include <mbedBug.h>
+#include "SBVentilator.h"
+#include <_KabukiTek.hpp>
 
 namespace SickBay {
 
-GHVentilator::GHVentilator ():
+SBVentilator::SBVentilator ():
     Status        (1),
     Ticks         (0),
     PressureMin   (0),
     PressureMax   (1) {}
 
-void GHVentilator::Init (int TicksSecond,
+void SBVentilator::Init (int TicksSecond,
                          int TicksCalibration, 
                          float HysteresisChamber,
                          float HysteresisPatient) {
@@ -45,10 +45,9 @@
     Channels[Index].Init (this, TicksInhale, TicksExhale, 
                           static_cast<uint32_t>(Delta));
   }
-  DPrintf("\nInitalized system with %d Ticks per Second.", TicksSecond);
 }
 
-void GHVentilator::TicksPEEPSet (int NewTicksPEEP) {
+void SBVentilator::TicksPEEPSet (int NewTicksPEEP) {
   int TicksPEEPMin = TicksSecond >> 5; //< This divides by 2^5.
   if (NewTicksPEEP < TicksPEEPMin || NewTicksPEEP > TicksSecond) {
     DPrintf("\n  > Error PEEP must be betwen 1/32 of a second to 1 second. <");
@@ -57,13 +56,13 @@
   TicksPEEP = NewTicksPEEP;
 }
 
-void GHVentilator::StateCalibrateEnter () {
+void SBVentilator::StateCalibrateEnter () {
   TurnOff ();
   BlowerTurnOn ();
   Status = StateCalibrate; //< Make sure to set this last.
 }
   
-void GHVentilator::StateCalibrateExit () {
+void SBVentilator::StateCalibrateExit () {
   PressureMax = Pressure;
   uint32_t HysteresisChamber = this->HysteresisChamber,
         PressureMid = (PressureMax - PressureMin) / 2;
@@ -73,40 +72,40 @@
            PressureMin, PressureMax);
 }
 
-void GHVentilator::StateSinkingEnter () {
+void SBVentilator::StateSinkingEnter () {
   Ticks = StateSinking;
   BlowerTurnOff ();
 }
 
-void GHVentilator::StateRisingEnter () {
+void SBVentilator::StateRisingEnter () {
   Ticks = StateRising;
   BlowerTurnOn ();
 }
 
-void GHVentilator::TurnOff () {
+void SBVentilator::TurnOff () {
   BlowerTurnOff();
   Ticks = 0;
   Status = 0;
   Channel1ValveSet (LLLow);
-  #if GHVentilatorChannelCount >= 2
+  #if SBVentilatorChannelCount >= 2
   Channel2ValveSet (LLLow);
   #endif
-  #if GHVentilatorChannelCount >= 3
+  #if SBVentilatorChannelCount >= 3
   Channel3ValveSet (LLLow);
   #endif
-  #if GHVentilatorChannelCount >= 4
+  #if SBVentilatorChannelCount >= 4
   Channel4ValveSet (LLLow);
   #endif
 }
 
-void GHVentilator::ChannelValveSet (GHVentilatorChannel* Channel, int Value) {
+void SBVentilator::ChannelValveSet (SBVentilatorChannel* Channel, int Value) {
   if      (Channel == &Channels[0]) Channel1ValveSet(Value);
   else if (Channel == &Channels[1]) Channel2ValveSet(Value);
   else if (Channel == &Channels[2]) Channel3ValveSet(Value);
   else if (Channel == &Channels[3]) Channel4ValveSet(Value);
 }
 
-int GHVentilator::TicksInhaleExhaleSet (int Index, 
+int SBVentilator::TicksInhaleExhaleSet (int Index, 
                                         int TicksInhale,
                                         int TicksExhale) {
   if (Index < 0 || Index >= ChannelCount) return -1;
@@ -119,7 +118,7 @@
   return 0;
 }
   
-void GHVentilator::Update() {
+void SBVentilator::Update() {
   int Tick = Ticks;
   if (Tick == 0) {
     int Status = this->Status;
@@ -145,13 +144,13 @@
   }
   // Check the Channels for state changes.
   for (int Index = ChannelCount - 1; Index >= 0; --Index) {
-    GHVentilatorChannel* Channel = &Channels[Index];
+    SBVentilatorChannel* Channel = &Channels[Index];
     int Tick = Channel->Ticks;
-    if (Tick <= GHVentilatorChannel::StateExhaling) {
+    if (Tick <= SBVentilatorChannel::StateExhaling) {
       if (Tick < Channel->TicksExhale) Channel->Inhale (); 
       else Channel->Ticks = Ticks - 1;
     }
-    else if (Tick >= GHVentilatorChannel::StateInhaling) {
+    else if (Tick >= SBVentilatorChannel::StateInhaling) {
       int TicksExhale = Channel->TicksExhale;
       if (Tick > TicksExhale) {
         if (Tick > TicksExhale - TicksPEEP) {
@@ -168,4 +167,4 @@
   }
 }
 }   //< namespace SickBay
-#include "GHVentilatorChannel.hpp"
\ No newline at end of file
+#include "SBVentilatorChannel.hpp"
\ No newline at end of file