diff --git a/web.cpp b/web.cpp index b4b6aa16ed1859ce1c4181536ea7c51255048293..7aab3a45131bea88610c0cabf2e78cae90d176f3 100644 --- a/web.cpp +++ b/web.cpp @@ -7,42 +7,26 @@ void web_setup () set_theme(1); + //Create tabs uint16_t tab1 = ESPUI.addControl(ControlType::Tab, "Configurations", "Configurations"); uint16_t tab3 = ESPUI.addControl(ControlType::Tab, "Nouvelle Seringue", "Nouvelle seringue"); uint16_t tab4 = ESPUI.addControl(ControlType::Tab, "Caracteristiques du pousse-seringue", "Caracteristiques du pousse-seringue"); - //***ABOVE***// //***Syringe-pump***// status_syringe_pump = ESPUI.label("Etat du pousse-seringue :", ControlColor::None, "A l'arrêt"); activation_syringe_pump = ESPUI.addControl(ControlType::Switcher, "Mise en marche", "Arrêt", ControlColor::None, status_syringe_pump, activation_syringe_pump_callback, (void*)19); - - //Style - style (status_syringe_pump, 2); - style (activation_syringe_pump, 2); //***Syringe-filled***// status_syringe_filled = ESPUI.label("Etat de la seringue :", ControlColor::None, "Pas en place"); syringe_filled_placement = ESPUI.addControl(ControlType::Switcher, "Mise en marche", "Arrêt", ControlColor::None, status_syringe_filled, syringe_filled_placement_callback, (void*)19); - - //Style - style (status_syringe_filled, 2); - style (syringe_filled_placement, 2); - - //***Initialisation***// initialisation = ESPUI.button("Initialisation", initialisation_callback, ControlColor::None, ""); - //ESPUI.updateVisibility(initialisation, false); - - //Style - style (initialisation, 2); - - //Deplacement demandé du pousse-seringue position_choice = ESPUI.number("Choix du volume à echanger", position_choice_callback, ControlColor::None, 0, 0, 50, (void*)19); @@ -51,13 +35,6 @@ void web_setup () switch_push_pull_choice = ESPUI.addControl(ControlType::Switcher, "Delivrer ou recupérer", "Délivrer", ControlColor::None, position_choice, switch_push_pull_choice_callback, (void*)19); ESPUI.updateSwitcher(switch_push_pull_choice, true); //pour mettre a "Delivrer" par défaut au début - - //Style - style (position_choice, 3); - style (label_push_pull_choice, 3); - style (switch_push_pull_choice, 3); - - //Volume restant label_remaining_volume = ESPUI.label("Volume restant en mL", ControlColor::None, "Volume restant en mL"); @@ -66,14 +43,6 @@ void web_setup () ESPUI.sliderContinuous = true; - //Style - style (label_remaining_volume, 3); - - - - - - //TAB1 = Configurations //Choix de la seringue 1 @@ -82,38 +51,27 @@ void web_setup () select_syringe_maj(tab1); - uint16_t syringe_ref = ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue 1 : ", "Reférence : ? " , ControlColor::None, tab1); - uint16_t syringe_brand =ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue 1 : ", "Marque : ? " , ControlColor::None, syringe_ref); - uint16_t syringe_volume =ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue 1 : ", "Volume total = ? mL" , ControlColor::None, syringe_ref); - uint16_t syringe_diameter =ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue 1 : ", "Diamètre interne = ? mm" , ControlColor::None, syringe_ref); + syringe_ref = ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue 1 : ", "Reférence : ? " , ControlColor::None, tab1); + syringe_brand =ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue 1 : ", "Marque : ? " , ControlColor::None, syringe_ref); + syringe_volume =ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue 1 : ", "Volume total = ? mL" , ControlColor::None, syringe_ref); + syringe_diameter =ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue 1 : ", "Diamètre interne = ? mm" , ControlColor::None, syringe_ref); + - style (syringe_ref, 3); - style (syringe_brand, 3); - style (syringe_volume, 3); - style (syringe_diameter, 3); choose_syringe = ESPUI.addControl(ControlType::Button, "Choisir cette seringue", "Valider", ControlColor::None, syringe_selection, choose_syringe_callback, (void*)19); - style (choose_syringe, 3); + //TAB3 : Nouvelle seringue - uint16_t name_new_syringe_label = ESPUI.addControl(ControlType::Label, "Nouvelle seringue", "Nom de la seringue :", ControlColor::None, tab3); + name_new_syringe_label = ESPUI.addControl(ControlType::Label, "Nouvelle seringue", "Nom de la seringue :", ControlColor::None, tab3); name_new_syringe = ESPUI.addControl(ControlType::Text, "Nouvelle seringue", "", ControlColor::None, name_new_syringe_label, name_new_syringe_callback); - uint16_t internal_diameter_new_syringe_label =ESPUI.addControl(ControlType::Label, "Nouvelle seringue", "Diamètre interne de la seringue en mm :", ControlColor::None, name_new_syringe_label); + internal_diameter_new_syringe_label =ESPUI.addControl(ControlType::Label, "Nouvelle seringue", "Diamètre interne de la seringue en mm :", ControlColor::None, name_new_syringe_label); internal_diameter_new_syringe = ESPUI.addControl(ControlType::Number, "Diamètre interne de la seringue en mm", "5", ControlColor::None, name_new_syringe_label, number_callback); - uint16_t total_volume_new_syringe_label =ESPUI.addControl(ControlType::Label, "Nouvelle seringue", "Volume total de la seringue en µL :", ControlColor::None, name_new_syringe_label); + total_volume_new_syringe_label =ESPUI.addControl(ControlType::Label, "Nouvelle seringue", "Volume total de la seringue en µL :", ControlColor::None, name_new_syringe_label); total_volume_new_syringe = ESPUI.addControl(ControlType::Number, "Volume total de la seringue en µL", "5", ControlColor::None, name_new_syringe_label, number_callback); - uint16_t add_syringe_label =ESPUI.addControl(ControlType::Label, "Nouvelle seringue", "Ajouter la seringue", ControlColor::None, name_new_syringe_label); + add_syringe_label =ESPUI.addControl(ControlType::Label, "Nouvelle seringue", "Ajouter la seringue", ControlColor::None, name_new_syringe_label); add_syringe = ESPUI.addControl(ControlType::Button, "Ajouter la seringue", "Valider", ControlColor::None, name_new_syringe_label, add_syringe_callback, (void*)19); - - style (name_new_syringe_label, 3); - style (name_new_syringe, 3); - style (internal_diameter_new_syringe_label, 3); - style (internal_diameter_new_syringe, 3); - style (total_volume_new_syringe_label, 3); - style (total_volume_new_syringe, 3); - style (add_syringe_label, 3); - style (add_syringe, 3); + //TAB4 : Configurations avancées //Diamètre de la vis @@ -123,12 +81,8 @@ void web_setup () clockwise_equals_push = ESPUI.addControl(ControlType::Switcher, "Sens de rotation du moteur", "Horaire =", ControlColor::None, clockwise_equals_push_label, clockwise_equals_push_callback); ESPUI.updateSwitcher(clockwise_equals_push, true); //pour mettre a "Horaire = Delivrer" par défaut au début - style (worm_diameter, 3); - style (clockwise_equals_push_label, 3); - style (clockwise_equals_push, 3); - - //Lancement + set_init_style(); ESPUI.begin("ESPUI Control"); } @@ -504,10 +458,49 @@ void set_init_style() /*** -Argument : / -Return : / --Action : / +-Action : Set up the initial style of every controller. ***/ { - //Mettre le style initial + //***ABOVE***// + + style (status_syringe_pump, 2); + style (activation_syringe_pump, 2); + + style (status_syringe_filled, 2); + style (syringe_filled_placement, 2); + + style (initialisation, 2); + + style (position_choice, 3); + style (label_push_pull_choice, 3); + style (switch_push_pull_choice, 3); + + style (label_remaining_volume, 3); + + //TAB1 = Configurations + style (syringe_ref, 3); + style (syringe_brand, 3); + style (syringe_volume, 3); + style (syringe_diameter, 3); + style (choose_syringe, 3); + + + style (name_new_syringe, 3); + style (internal_diameter_new_syringe, 3); + style (total_volume_new_syringe, 3); + style (add_syringe, 3); + style (name_new_syringe_label, 3); + style (internal_diameter_new_syringe_label, 3); + style (total_volume_new_syringe_label, 3); + style (add_syringe_label, 3); + + + //TAB4 : Configurations avancées + + style (worm_diameter, 3); + style (clockwise_equals_push_label, 3); + style (clockwise_equals_push, 3); + } void set_theme(int theme) diff --git a/web.h b/web.h index b140b8af15cbdde9a29c49956b41436305540bb2..1c39a7aa01d108c70ded04e207656bb72600848d 100644 --- a/web.h +++ b/web.h @@ -31,10 +31,10 @@ uint16_t label_remaining_volume; //TAB1 = Configurations -uint16_t choose_syringe; +uint16_t syringe_selection, syringe_ref, syringe_brand, syringe_volume, syringe_diameter, choose_syringe; //TAB3 : Nouvelle seringue -uint16_t name_new_syringe, internal_diameter_new_syringe, total_volume_new_syringe, add_syringe; +uint16_t name_new_syringe, name_new_syringe_label, internal_diameter_new_syringe, internal_diameter_new_syringe_label, total_volume_new_syringe, total_volume_new_syringe_label, add_syringe, add_syringe_label; //TAB4 : Configurations avancées @@ -43,7 +43,6 @@ uint16_t worm_diameter, clockwise_equals_push_label, clockwise_equals_push; //A trier encore -uint16_t syringe_selection, syringe_ref, syringe_brand, syringe_volume, syringe_diameter; String select_value;