diff --git a/web.cpp b/web.cpp index 0133f6685c5c4f44a51474dddfc58226f9533d51..b21c5bdf9925ecbb0ad58954958d4843e1030b15 100644 --- a/web.cpp +++ b/web.cpp @@ -39,34 +39,38 @@ void web_setup () ESPUI.sliderContinuous = true; + //Volume_exchange_wanted + volume_exchange_mL_label = ESPUI.addControl(ControlType::Label, "Caractéristiques de l'échange", "Volume à échanger en mL", ControlColor::None); + volume_exchange_mL = ESPUI.addControl(ControlType::Number,"Caractéristiques de l'échange", "", ControlColor::None, volume_exchange_mL_label, volume_exchange_mL_callback, (void*)19); + + exchange_throughtput_uL_per_sec_label = ESPUI.addControl(ControlType::Label, "Caractéristiques de l'échange", "Débit de l'échange en uL/sec", ControlColor::None, volume_exchange_mL_label); + exchange_throughtput_uL_per_sec = ESPUI.addControl(ControlType::Number,"Caractéristiques de l'échange", "", ControlColor::None, volume_exchange_mL_label, exchange_throughtput_uL_per_sec_callback, (void*)19); + + + label_push_pull_choice = ESPUI.addControl(ControlType::Label, "Delivrer ou recupérer", "Délivrer", ControlColor::None, volume_exchange_mL_label); + switch_push_pull_choice = ESPUI.addControl(ControlType::Switcher, "Delivrer ou recupérer", "Délivrer", ControlColor::None, volume_exchange_mL_label, switch_push_pull_choice_callback, (void*)19); + ESPUI.updateSwitcher(switch_push_pull_choice, true); //pour mettre a "Delivrer" par défaut au début + //Configurations //Choice_of_syringe_model - ESPUI.addControl(ControlType::Separator, "Seringue 1", "", ControlColor::None, configurations); syringe_selection = ESPUI.addControl(ControlType::Select, "Choix de la seringue :", "", ControlColor::None, configurations, syringe_selection_callback); select_syringe_maj(configurations); - //test - float diametre = 10; - std::string temp = "internal diameter : " + std::to_string(diametre); - //fin test - syringe_volume_mL =ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue : ", "Volume total = ? mL" , ControlColor::None, syringe_ref); - syringe_diameter_mm =ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue : ", temp.c_str(), ControlColor::None, syringe_ref); + syringe_volume_mL_value = 5; + syringe_volume_mL_string = "Volume total: " + std::to_string(syringe_volume_mL_value) + "mL"; + syringe_volume_mL =ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue : ", syringe_volume_mL_string.c_str() , ControlColor::None, configurations); + + syringe_diameter_mm_value = 5; + syringe_diameter_mm_string = "internal diameter : " + std::to_string(syringe_volume_mL_value) + "mm"; + syringe_diameter_mm =ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue : ", syringe_diameter_mm_string.c_str(), ControlColor::None, syringe_volume_mL); choose_syringe = ESPUI.addControl(ControlType::Button, "Choisir cette seringue", "Utiliser cette seringue", ControlColor::None, syringe_selection, choose_syringe_callback, (void*)19); ESPUI.addControl(ControlType::Separator, "", "", ControlColor::None, configurations); - //Volume_exchange_wanted - volume_exchange_mL = ESPUI.addControl(ControlType::Number,"Choix du volume à echanger en mL", "", ControlColor::None, configurations, volume_exchange_mL_callback, (void*)19); - - - label_push_pull_choice = ESPUI.addControl(ControlType::Label, "Delivrer ou recupérer", "Délivrer", ControlColor::None, volume_exchange_mL); - switch_push_pull_choice = ESPUI.addControl(ControlType::Switcher, "Delivrer ou recupérer", "Délivrer", ControlColor::None, volume_exchange_mL, switch_push_pull_choice_callback, (void*)19); - ESPUI.updateSwitcher(switch_push_pull_choice, true); //pour mettre a "Delivrer" par défaut au début - //New_syringe name_new_syringe_label = ESPUI.addControl(ControlType::Label, "Nouvelle seringue", "Nom de la seringue :", ControlColor::None, new_syringe); @@ -178,6 +182,7 @@ void initialisation_callback (Control *sender, int type) style (activation_syringe_pump, 1); } } + void volume_exchange_mL_callback (Control* sender, int value, void* param) /*** -Argument : Pointer to the controller calling the function, integer according to the controller type. @@ -190,6 +195,19 @@ void volume_exchange_mL_callback (Control* sender, int value, void* param) syringe_filled.write_Json (); } +void 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 : / +-Action : Enable to choose the volume that woud be exchanged. +***/ +{ + Serial.printf("val=%s\n", sender->value.c_str()); + syringe_filled.set_exchange_throughput_uL_per_sec(atof(sender->value.c_str())); + syringe_filled.write_Json (); +} + + void 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. @@ -207,7 +225,10 @@ void switch_push_pull_choice_callback (Control* sender, int value, void* param) ESPUI.print(label_push_pull_choice, "Délivrer"); - style (volume_exchange_mL, 1); + style (volume_exchange_mL_label, 1); + style (volume_exchange_mL, 1); + style (exchange_throughtput_uL_per_sec_label, 1); + style (exchange_throughtput_uL_per_sec, 1); style (label_push_pull_choice, 1); style (switch_push_pull_choice, 1); @@ -219,7 +240,10 @@ void switch_push_pull_choice_callback (Control* sender, int value, void* param) ESPUI.print(label_push_pull_choice, "Recupérer"); - style (volume_exchange_mL, 2); + style (volume_exchange_mL_label, 2); + style (volume_exchange_mL, 2); + style (exchange_throughtput_uL_per_sec_label, 2); + style (exchange_throughtput_uL_per_sec, 2); style (label_push_pull_choice, 2); style (switch_push_pull_choice, 2); break; @@ -254,6 +278,20 @@ void choose_syringe_callback (Control* sender, int value, void* param) { case B_DOWN: Serial.println("Button DOWN"); + + //syringe_volume_mL_value = 2; //Mettre la valeur associé au nom choisit du select + syringe_volume_mL_value = syringe.get_syringe_database()[select_value]["total_volume_mL"]; + syringe_volume_mL_string = "Volume total: " + std::to_string(syringe_volume_mL_value) + "mL"; + ESPUI.print(syringe_volume_mL, syringe_volume_mL_string.c_str()); + + //syringe_diameter_mm_value = 1; //Mettre la valeur associé au nom choisit du select + syringe_diameter_mm_value = syringe.get_syringe_database()[select_value]["internal_diameter_mm"]; + syringe_diameter_mm_string = "internal diameter : " + std::to_string(syringe_volume_mL_value) + "mm"; + ESPUI.print(syringe_diameter_mm, syringe_diameter_mm_string.c_str()); + + + + break; case B_UP: @@ -517,7 +555,10 @@ void set_init_style() style (initialisation, 2); - style (volume_exchange_mL, 1); + style (volume_exchange_mL_label, 1); + style (volume_exchange_mL, 1); + style (exchange_throughtput_uL_per_sec_label, 1); + style (exchange_throughtput_uL_per_sec, 1); style (label_push_pull_choice, 1); style (switch_push_pull_choice, 1); @@ -528,7 +569,6 @@ void set_init_style() style (syringe_diameter_mm, 3); style (choose_syringe, 3); - style (name_new_syringe, 3); style (internal_diameter_mm_new_syringe, 3); style (total_volume_mL_new_syringe, 3); @@ -538,6 +578,8 @@ void set_init_style() style (total_volume_mL_new_syringe_label, 3); style (add_syringe_label, 3); + + //features : Configurations avancées diff --git a/web.h b/web.h index 3d0ed34037e9fe6f01be2d6c621f54501040e0a5..5fac25447a16b572c1f23068b966655c0154eebb 100644 --- a/web.h +++ b/web.h @@ -27,7 +27,7 @@ uint16_t syringe_filled_placement; uint16_t initialisation; -uint16_t volume_exchange_mL, label_push_pull_choice, switch_push_pull_choice; +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; uint16_t label_remaining_volume_mL; @@ -36,6 +36,10 @@ uint16_t remaining_volume_mL; //Configurations uint16_t syringe_selection, syringe_ref, syringe_brand, syringe_volume_mL, syringe_diameter_mm, choose_syringe; +float syringe_volume_mL_value, syringe_diameter_mm_value; + +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; @@ -81,6 +85,7 @@ void activation_syringe_pump_callback (Control* sender, int value, void* param); void syringe_filled_placement_callback (Control* sender, int value, void* param); void 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);