diff --git a/arduino/hev_prototype_v1/src/BreathingLoop.cpp b/arduino/hev_prototype_v1/src/BreathingLoop.cpp index 138ecd7322672eeb038cee3124ac3476b8282900..a8134fdca91a1443feb7e33abfdfd8561163fcb9 100644 --- a/arduino/hev_prototype_v1/src/BreathingLoop.cpp +++ b/arduino/hev_prototype_v1/src/BreathingLoop.cpp @@ -103,7 +103,7 @@ void BreathingLoop::updateReadings() //volume = Integral //flow = Derivative - _valves_controller.setValves(VALVE_STATE::CLOSED, VALVE_STATE::CLOSED, _valve_inhale_PID_percentage*VALVE_STATE::OPEN, VALVE_STATE::CLOSED, VALVE_STATE::CLOSED); + //_valves_controller.setValves(VALVE_STATE::CLOSED, VALVE_STATE::CLOSED, _valve_inhale_PID_percentage*VALVE_STATE::OPEN, VALVE_STATE::CLOSED, VALVE_STATE::CLOSED); } @@ -569,4 +569,4 @@ void BreathingLoop::doPID(float target_pressure, float process_pressure, float & pid_variables& BreathingLoop::getPIDVariables() { return _pid; -} \ No newline at end of file +} diff --git a/raspberry-dataserver/CommsDebug.py b/raspberry-dataserver/CommsDebug.py index 06a9422fd9a3874eb3f28d976550a1012c46e16f..253fbd4c31c7dc9d9577923dc34446c802698f77 100755 --- a/raspberry-dataserver/CommsDebug.py +++ b/raspberry-dataserver/CommsDebug.py @@ -32,14 +32,13 @@ class Dependant(object): def update_llipacket(self, payload): #logging.info(f"payload received: {payload}") - if hasattr(payload, 'ventilation_mode'): - logging.info(f"payload received: {payload.ventilation_mode}") - #logging.info(f"payload received: {payload.fsm_state}") if payload.getType() == 1: - logging.info(f"Fsm state: {payload.fsm_state}") - #logging.info(f"payload received: {payload.timestamp}") - if hasattr(payload, 'duration_inhale'): - logging.info(f"payload received: inhale duration = {payload.duration_inhale} ") + logging.info(f"payload received: {payload}") + #logging.info(f"Fsm state: {payload.fsm_state}") + #if hasattr(payload, 'ventilation_mode'): + # logging.info(f"payload received: {payload.ventilation_mode}") + #if hasattr(payload, 'duration_inhale'): + # logging.info(f"payload received: inhale duration = {payload.duration_inhale} ") self._llipacket = payload.getDict() # returns a dict @@ -51,13 +50,19 @@ async def commsDebug(): await asyncio.sleep(1) comms.writePayload(cmd) print('sent cmd start') + toggle = 2 while True: await asyncio.sleep(15) - cmd = CommandFormat(cmd_type=CMD_TYPE.SET_PID.value, cmd_code=CMD_SET_PID.KP.value, param=200) # to set Kp=0.2, param=200 i.e., milli_Kp - comms.writePayload(cmd) - print('sent cmd set Kp = 0.2') + #cmd = CommandFormat(cmd_type=CMD_TYPE.SET_PID.value, cmd_code=CMD_SET_PID.KP.value, param=200) # to set Kp=0.2, param=200 i.e., milli_Kp + #comms.writePayload(cmd) + #print('sent cmd set Kp = 0.2') await asyncio.sleep(15) - cmd = CommandFormat(cmd_type=CMD_TYPE.GENERAL.value, cmd_code=CMD_GENERAL.STOP.value, param=0) + cmd = CommandFormat(cmd_type=CMD_TYPE.GENERAL.value, cmd_code=toggle, param=0) + if toggle == 2 : + toggle = 1 + else : + toggle = 2 + comms.writePayload(cmd) print('sent cmd stop')