-
Malaurie Bernard authored
Fixing arduinoson problems by using singletons for syringe and syringefilled instead of static members.
Malaurie Bernard authoredFixing arduinoson problems by using singletons for syringe and syringefilled instead of static members.
syringefilled.h 2.31 KiB
#pragma once
#include "syringe.h"
#include "motor.h"
#include <ArduinoJson.h>
#include "math.h"
#include <interrupts.h> // InterruptLock
using InterruptLock = esp8266::InterruptLock;
#include "fs.h"
#include "common.h"
#define syringe_pump_length_mm 50
class SyringeFilled : public Motor
{
/***
* Role of this class :
* -Store information about liquid
* -Get informations about movement required
* -Manage movements
***/
private :
//SyringeFilled
float _exchange_throughput_uL_per_sec;
float _exchange_volume_mL;
float _remaining_volume_mL;
bool _push; //false means pull
//Syringe
String _name_syringe; //Not sure how to manage it
//Syringe_Pump
float _screw_thread_mm;
bool _clockwise_equals_push;
//Limit_Switch
bool _emergency;
//JSON DOCUMENT
StaticJsonDocument<200> syringe_filled_json; //200 = RAM allocated to this document
public :
//CONSTRUCTORS
SyringeFilled(MotorHardware_t& stepper);
//SET METHODS
void set_exchange_throughput_uL_per_sec(float exchange_throughput_uL_per_sec);
void set_exchange_volume_mL(float exchange_volume_mL);
void set_remaining_volume_mL(float remaining_volume_mL);
void set_push(bool push);
void set_name_syringe(String name_syringe);
void set_screw_thread_mm(float screw_thread_mm);
void set_clockwise_equals_push(bool clockwise_equals_push);
void set_emergency(bool emergency);
//GET METHODS
float get_exchange_throughput_uL_per_sec();
float get_exchange_volume_mL();
float get_remaining_volume_mL();
bool get_push();
String get_name_syringe();
float get_screw_thread_mm();
bool get_clockwise_equals_push();
bool get_emergency();
const StaticJsonDocument<200>& get_syringe_filled_data();
//CONVERSIONS
float volume_to_distance(float volume_mL);
float distance_to_volume(float distance_mm); //CLI
//MOVEMENTS
bool is_running ();
void move();
void go_to_zero(); //CLI
//LIMIT SWITCH
void manage_emergency (bool pressed, bool stepperMoving);
void run_from_emergency(); //CLI
//CONFIGURATIONS
bool check_configuration(); //CLI
void show_configuration(); //CLI
//JSON
void read_Json ();
void write_Json ();
};
extern SyringeFilled syringe_filled;