diff --git a/web.cpp b/web.cpp index 4d3bc8196de8a4c6659757596e08be39037c14f5..57a7011219e7c8c3438d6ae5c2b8358ce7aa6635 100644 --- a/web.cpp +++ b/web.cpp @@ -2,10 +2,27 @@ #include "web.h" -void web_setup () +void Web :: web_setup() { + + HeapSelectIram abc; + + last_time = 0; + + couleurs[0] = couleur1; + couleurs[1] = couleur2; + couleurs[2] = couleur3; + couleurs[3] = couleur4; + couleurs[4] = couleur5; + couleurs[5] = couleur6; + couleurs[6] = couleur7; + couleurs[7] = couleur8; + couleurs[8] = couleur9; + couleurs[9] = couleur10; + + set_theme(1); //Create tabs @@ -146,7 +163,7 @@ void web_setup () /************CALLBACK_METHODS****************/ //GENERAL CALLBACKS// -void number_callback(Control* sender, int type) +void Web :: number_callback(Control* sender, int type) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -164,7 +181,7 @@ void number_callback(Control* sender, int type) //***ABOVE***// -void stop_syringe_pump_callback (Control* sender, int value, void* param) +void Web :: stop_syringe_pump_callback (Control* sender, int value, void* param) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -179,7 +196,7 @@ void stop_syringe_pump_callback (Control* sender, int value, void* param) } -void syringe_filled_placement_callback (Control* sender, int value, void* param) +void Web :: syringe_filled_placement_callback (Control* sender, int value, void* param) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -203,7 +220,7 @@ void syringe_filled_placement_callback (Control* sender, int value, void* param) Serial.println(""); } -void calibration_callback (Control *sender, int type) +void Web :: calibration_callback (Control *sender, int type) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -224,7 +241,7 @@ void calibration_callback (Control *sender, int type) Serial.println(""); } -void fast_backward_callback (Control *sender, int type) +void Web :: fast_backward_callback (Control *sender, int type) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -252,7 +269,7 @@ void fast_backward_callback (Control *sender, int type) } -void fast_forward_callback (Control *sender, int type) +void Web :: fast_forward_callback (Control *sender, int type) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -281,7 +298,7 @@ void fast_forward_callback (Control *sender, int type) serial_print ("Fast_forward", sender); } -void slow_backward_callback (Control *sender, int type) +void Web :: slow_backward_callback (Control *sender, int type) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -309,7 +326,7 @@ void slow_backward_callback (Control *sender, int type) } -void slow_forward_callback (Control *sender, int type) +void Web :: slow_forward_callback (Control *sender, int type) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -336,7 +353,7 @@ void slow_forward_callback (Control *sender, int type) serial_print ("Slow_forward", sender); } -void confirm_initialisation_callback (Control *sender, int type) +void Web :: confirm_initialisation_callback (Control *sender, int type) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -360,7 +377,7 @@ void confirm_initialisation_callback (Control *sender, int type) } -void volume_exchange_mL_callback (Control* sender, int value, void* param) +void Web :: volume_exchange_mL_callback (Control* sender, int value, void* param) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -380,7 +397,7 @@ void volume_exchange_mL_callback (Control* sender, int value, void* param) } -void exchange_throughtput_uL_per_sec_callback (Control* sender, int value, void* param) +void Web :: exchange_throughtput_uL_per_sec_callback (Control* sender, int value, void* param) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -399,7 +416,7 @@ void exchange_throughtput_uL_per_sec_callback (Control* sender, int value, void* } -void switch_push_pull_choice_callback (Control* sender, int value, void* param) +void Web :: switch_push_pull_choice_callback (Control* sender, int value, void* param) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -434,7 +451,7 @@ void switch_push_pull_choice_callback (Control* sender, int value, void* param) Serial.println(""); } -void remaining_volume_mL_callback (Control* sender, int value, void* param) +void Web :: remaining_volume_mL_callback (Control* sender, int value, void* param) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -445,7 +462,7 @@ void remaining_volume_mL_callback (Control* sender, int value, void* param) } -void remaining_time_sec_callback (Control* sender, int value, void* param) +void Web :: remaining_time_sec_callback (Control* sender, int value, void* param) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -456,7 +473,7 @@ void remaining_time_sec_callback (Control* sender, int value, void* param) ESPUI.updateSlider(remaining_time_sec, remaining_time_sec_value); } -void start_exchange_callback (Control* sender, int value, void* param) +void Web :: start_exchange_callback (Control* sender, int value, void* param) {(void)param; //Avoid the unused Warning syringe_filled.start_exchange(); @@ -468,7 +485,7 @@ void start_exchange_callback (Control* sender, int value, void* param) //configurations = Configurations -void initial_volume_mL_callback (Control* sender, int value, void* param) +void Web :: initial_volume_mL_callback (Control* sender, int value, void* param) {(void)param; //Avoid the unused Warning syringe_filled.set_remaining_volume_mL((sender->value).toFloat()); syringe_filled.write_Json(); @@ -483,7 +500,7 @@ void initial_volume_mL_callback (Control* sender, int value, void* param) } -void choose_syringe_callback (Control* sender, int value, void* param) +void Web :: choose_syringe_callback (Control* sender, int value, void* param) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -523,7 +540,7 @@ void choose_syringe_callback (Control* sender, int value, void* param) } -void name_new_syringe_callback(Control* sender, int type) +void Web :: name_new_syringe_callback(Control* sender, int type) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -536,7 +553,7 @@ void name_new_syringe_callback(Control* sender, int type) } -void total_volume_mL_new_syringe_callback(Control* sender, int type) +void Web :: total_volume_mL_new_syringe_callback(Control* sender, int type) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -549,7 +566,7 @@ void total_volume_mL_new_syringe_callback(Control* sender, int type) } -void internal_diameter_mm_new_syringe_callback(Control* sender, int type) +void Web :: internal_diameter_mm_new_syringe_callback(Control* sender, int type) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -562,7 +579,7 @@ void internal_diameter_mm_new_syringe_callback(Control* sender, int type) } -void add_syringe_callback (Control* sender, int value, void* param) +void Web :: add_syringe_callback (Control* sender, int value, void* param) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -592,7 +609,7 @@ void add_syringe_callback (Control* sender, int value, void* param) //features : Configurations avancées -void syringe_pump_length_mm_callback(Control* sender, int type) +void Web :: syringe_pump_length_mm_callback(Control* sender, int type) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -610,7 +627,7 @@ void syringe_pump_length_mm_callback(Control* sender, int type) Serial.println(""); } -void clockwise_equals_push_callback(Control* sender, int value) +void Web :: clockwise_equals_push_callback(Control* sender, int value) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -641,7 +658,7 @@ void clockwise_equals_push_callback(Control* sender, int value) Serial.println(""); } -void microstep_configuration_callback(Control* sender, int type) +void Web :: microstep_configuration_callback(Control* sender, int type) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -659,7 +676,7 @@ void microstep_configuration_callback(Control* sender, int type) Serial.println(""); } -void motor_steps_callback(Control* sender, int type) +void Web :: motor_steps_callback(Control* sender, int type) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -681,7 +698,7 @@ void motor_steps_callback(Control* sender, int type) // -void syringe_selection_callback(Control* sender, int value) +void Web :: syringe_selection_callback(Control* sender, int value) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. -Return : / @@ -701,7 +718,7 @@ void syringe_selection_callback(Control* sender, int value) //ON_OFF METHODS -void syringe_pump_on_off() +void Web :: syringe_pump_on_off() /*** -Argument : / -Return : / @@ -720,7 +737,7 @@ void syringe_pump_on_off() /*************STYLE_METHODS****************/ -void style (uint16_t id, int style) +void Web :: style (uint16_t id, int style) /*** -Argument : The controller id and the style wanted. -Return : / @@ -749,7 +766,7 @@ void style (uint16_t id, int style) } -void set_initial_style() +void Web :: set_initial_style() /*** -Argument : / -Return : / @@ -815,7 +832,7 @@ void set_initial_style() } -void set_theme(int theme) +void Web :: set_theme(int theme) /*** -Argument : Integer defining the theme wanted. -Return : / @@ -851,7 +868,7 @@ void set_theme(int theme) -void style_syringe_pump_on() +void Web :: style_syringe_pump_on() /*** -Argument : / -Return : / @@ -866,7 +883,7 @@ void style_syringe_pump_on() } -void style_syringe_pump_off() +void Web :: style_syringe_pump_off() /*** -Argument : / -Return : / @@ -882,7 +899,7 @@ void style_syringe_pump_off() syringe_filled.stop(); } -void style_syringe_filled_placement_on() +void Web :: style_syringe_filled_placement_on() /*** -Argument : / -Return : / @@ -899,7 +916,7 @@ void style_syringe_filled_placement_on() style (calibration, 2); } -void style_syringe_filled_placement_off() +void Web :: style_syringe_filled_placement_off() /*** -Argument : / -Return : / @@ -917,7 +934,7 @@ void style_syringe_filled_placement_off() } -void style_initialisation(int style_choice) +void Web :: style_initialisation(int style_choice) { style (fast_forward, style_choice); style (fast_backward, style_choice); @@ -926,7 +943,7 @@ void style_initialisation(int style_choice) style (confirm_initialisation, style_choice); } -void style_exchange_configuration(int style_choice) +void Web :: style_exchange_configuration(int style_choice) { style (initial_volume_mL, style_choice); style (initial_volume_mL_label, style_choice); @@ -942,7 +959,7 @@ void style_exchange_configuration(int style_choice) //OTHER METHODS -void select_syringe_maj(uint16_t tab) +void Web :: select_syringe_maj(uint16_t tab) /*** -Argument : The page on which the info must display. -Return : / @@ -961,13 +978,13 @@ void select_syringe_maj(uint16_t tab) } -void number_max_min(int min, int max, uint16_t control) +void Web :: number_max_min(int min, int max, uint16_t control) { ESPUI.addControl(Min, "", String(min), ControlColor :: None, control); ESPUI.addControl(Max, "", String(max), ControlColor :: None, control); } -void serial_print (String name, Control* sender) +void Web :: serial_print (String name, Control* sender) { Serial.println(name); Serial.println(String("Value: ") + String(sender->type)); @@ -978,7 +995,7 @@ void serial_print (String name, Control* sender) //WEB_LOOP// -void web_loop () +void Web :: web_loop() { if(millis() > last_time + 500) { diff --git a/web.h b/web.h index e5d3d146848b8515226e2748491038ea6d46bb9e..96f70411ca4ccf07402a4c2fee104e82ee8baaea 100644 --- a/web.h +++ b/web.h @@ -13,128 +13,128 @@ #include <EEPROM.h> +class Web +{ + +private : + //Create tabs -uint16_t configurations, new_syringe, features; +static uint16_t configurations, new_syringe, features; //***ABOVE***// -int status_syringe_pump; -uint16_t stop_syringe_pump; +static int status_syringe_pump; +static uint16_t stop_syringe_pump; -int status_syringe_filled_placement; -uint16_t syringe_filled_placement; +static int status_syringe_filled_placement; +static uint16_t syringe_filled_placement; -int status_limit_switch; +static int status_limit_switch; -uint16_t calibration, fast_backward, fast_forward, slow_backward, slow_forward, confirm_initialisation; +static uint16_t calibration, fast_backward, fast_forward, slow_backward, slow_forward, confirm_initialisation; -uint16_t volume_exchange_mL_label, volume_exchange_mL, exchange_throughtput_uL_per_sec_label, exchange_throughtput_uL_per_sec, label_push_pull_choice, switch_push_pull_choice, start_exchange; +static uint16_t volume_exchange_mL_label, volume_exchange_mL, exchange_throughtput_uL_per_sec_label, exchange_throughtput_uL_per_sec, label_push_pull_choice, switch_push_pull_choice, start_exchange; -uint16_t label_remaining_volume_mL, label_remaining_time_sec; -uint16_t remaining_volume_mL, remaining_time_sec; +static uint16_t label_remaining_volume_mL, label_remaining_time_sec; +static uint16_t remaining_volume_mL, remaining_time_sec; //Configurations -uint16_t syringe_selection, syringe_ref, syringe_brand, syringe_volume_mL, syringe_diameter_mm, initial_volume_mL_label, initial_volume_mL, choose_syringe; +static uint16_t syringe_selection, syringe_ref, syringe_brand, syringe_volume_mL, syringe_diameter_mm, initial_volume_mL_label, initial_volume_mL, choose_syringe; -float syringe_volume_mL_value, syringe_diameter_mm_value; +static float syringe_volume_mL_value, syringe_diameter_mm_value; -std::string syringe_volume_mL_string, syringe_diameter_mm_string; +static std::string syringe_volume_mL_string, syringe_diameter_mm_string; //New_syringe -uint16_t name_new_syringe, name_new_syringe_label, internal_diameter_mm_new_syringe, internal_diameter_mm_new_syringe_label, total_volume_mL_new_syringe, total_volume_mL_new_syringe_label, add_syringe, add_syringe_label; -String name_new_syringe_value, total_volume_mL_new_syringe_value, internal_diameter_mm_new_syringe_value; +static uint16_t name_new_syringe, name_new_syringe_label, internal_diameter_mm_new_syringe, internal_diameter_mm_new_syringe_label, total_volume_mL_new_syringe, total_volume_mL_new_syringe_label, add_syringe, add_syringe_label; +static String name_new_syringe_value, total_volume_mL_new_syringe_value, internal_diameter_mm_new_syringe_value; //Features -uint16_t syringe_pump_length_mm_value; -uint16_t lead_screw_pitch_mm, clockwise_equals_push_label, clockwise_equals_push, microstep_configuration, motor_steps; +static uint16_t syringe_pump_length_mm_value; +static uint16_t lead_screw_pitch_mm, clockwise_equals_push_label, clockwise_equals_push, microstep_configuration, motor_steps; //Other -String select_value; +static String select_value; -char couleur1[30], couleur2[30], couleur3[30], couleur4[30], couleur5[30], couleur6[30], couleur7[30], couleur8[30], couleur9[30], couleur10[30]; +static char couleur1[30], couleur2[30], couleur3[30], couleur4[30], couleur5[30], couleur6[30], couleur7[30], couleur8[30], couleur9[30], couleur10[30]; -long unsigned last_time = 0; +static long unsigned last_time; // Couleurs à utiliser -const char* couleurs[] = { - couleur1, - couleur2, - couleur3, - couleur4, - couleur5, - couleur6, - couleur7, - couleur8, - couleur9, - couleur10 -}; +static const char* couleurs[10]; +public : + +static void web_setup(); +static void web_loop(); /************CALLBACK_METHODS****************/ //GENERAL CALLBACKS// -void number_callback(Control* sender, int type); +static void number_callback(Control* sender, int type); //SPECIFIC CALLBACKS// //***ABOVE***// -void stop_syringe_pump_callback (Control* sender, int value, void* param); -void syringe_filled_placement_callback (Control* sender, int value, void* param); -void calibration_callback(Control* sender, int type); -void fast_backward_callback (Control *sender, int type); -void fast_forward_callback (Control *sender, int type); -void slow_backward_callback (Control *sender, int type); -void slow_forward_callback (Control *sender, int type); -void confirm_initialisation_callback (Control *sender, int type); -void volume_exchange_mL_callback (Control* sender, int value, void* param); -void exchange_throughtput_uL_per_sec_callback (Control* sender, int value, void* param); -void switch_push_pull_choice_callback (Control* sender, int value, void* param); -void remaining_volume_mL_callback (Control* sender, int value, void* param); -void remaining_time_sec_callback (Control* sender, int value, void* param); -void start_exchange_callback (Control* sender, int value, void* param); +static void stop_syringe_pump_callback (Control* sender, int value, void* param); +static void syringe_filled_placement_callback (Control* sender, int value, void* param); +static void calibration_callback(Control* sender, int type); +static void fast_backward_callback (Control *sender, int type); +static void fast_forward_callback (Control *sender, int type); +static void slow_backward_callback (Control *sender, int type); +static void slow_forward_callback (Control *sender, int type); +static void confirm_initialisation_callback (Control *sender, int type); +static void volume_exchange_mL_callback (Control* sender, int value, void* param); +static void exchange_throughtput_uL_per_sec_callback (Control* sender, int value, void* param); +static void switch_push_pull_choice_callback (Control* sender, int value, void* param); +static void remaining_volume_mL_callback (Control* sender, int value, void* param); +static void remaining_time_sec_callback (Control* sender, int value, void* param); +static void start_exchange_callback (Control* sender, int value, void* param); //Configurations -void choose_syringe_callback (Control* sender, int value, void* param); -void initial_volume_mL_callback (Control* sender, int value, void* param); +static void choose_syringe_callback (Control* sender, int value, void* param); +static void initial_volume_mL_callback (Control* sender, int value, void* param); -void name_new_syringe_callback(Control* sender, int type); -void total_volume_mL_new_syringe_callback(Control* sender, int type); -void internal_diameter_mm_new_syringe_callback(Control* sender, int type); -void add_syringe_callback (Control* sender, int value, void* param); +static void name_new_syringe_callback(Control* sender, int type); +static void total_volume_mL_new_syringe_callback(Control* sender, int type); +static void internal_diameter_mm_new_syringe_callback(Control* sender, int type); +static void add_syringe_callback (Control* sender, int value, void* param); //features : Configurations avancées -void syringe_pump_length_mm_callback(Control* sender, int type); -void clockwise_equals_push_callback(Control* sender, int value); -void microstep_configuration_callback(Control* sender, int type); -void motor_steps_callback(Control* sender, int type); +static void syringe_pump_length_mm_callback(Control* sender, int type); +static void clockwise_equals_push_callback(Control* sender, int value); +static void microstep_configuration_callback(Control* sender, int type); +static void motor_steps_callback(Control* sender, int type); // -void syringe_selection_callback(Control* sender, int value); +static void syringe_selection_callback(Control* sender, int value); //ON_OFF METHODS -void syringe_pump_on_off(); +static void syringe_pump_on_off(); //STYLE_METHODS -void style (uint16_t id, int style); -void set_initial_style(); -void set_theme(int theme); -void style_syringe_pump_on(); -void style_syringe_pump_off(); -void style_syringe_filled_placement_on(); -void style_syringe_filled_placement_off(); -void style_initialisation(int style_choice); -void style_exchange_configuration(int style_choice); +static void style (uint16_t id, int style); +static void set_initial_style(); +static void set_theme(int theme); +static void style_syringe_pump_on(); +static void style_syringe_pump_off(); +static void style_syringe_filled_placement_on(); +static void style_syringe_filled_placement_off(); +static void style_initialisation(int style_choice); +static void style_exchange_configuration(int style_choice); //OTHER_METHODS -void select_syringe_maj(uint16_t tab); -void number_max_min(int min, int max, uint16_t control); -void serial_print (String name, Control* sender); +static void select_syringe_maj(uint16_t tab); +static void number_max_min(int min, int max, uint16_t control); +static void serial_print (String name, Control* sender); + +};