diff --git a/web.cpp b/web.cpp index e1865cc1e70ee981cfe17fbfb6a5abd8b875ea6a..843bb52d045ea3b4428fc1b2f0ce2ce3c814690b 100644 --- a/web.cpp +++ b/web.cpp @@ -69,7 +69,10 @@ void web_setup () //Deplacement demandé du pousse-seringue position_choice = ESPUI.number("Choix du volume à echanger", position_choice_callback, ControlColor::None, 0, 0, 50, (void*)19); - label_position_choice = ESPUI.addControl(ControlType::Label, "Distance", "0", ControlColor::None, position_choice, status_position_choice_callback); + label_push_pull_choice = ESPUI.addControl(ControlType::Label, "Delivrer ou recupérer", "Délivrer", ControlColor::None, position_choice, status_position_choice_callback); + 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.addControl(ControlType::Slider, "Distance", "0", ControlColor::None, position_choice, progress_move_callback, (void*)19); ESPUI.sliderContinuous = true; @@ -77,7 +80,7 @@ void web_setup () //Style style (position_choice, 3); - style (label_position_choice, 3); + style (label_push_pull_choice, 3); @@ -114,6 +117,7 @@ void web_setup () add_syringe = ESPUI.addControl(ControlType::Button, "Ajouter la seringue", "Valider", ControlColor::None, new_syringe, add_syringe_callback, (void*)19); style (new_syringe, 3); + style (add_syringe, 3); //TAB4 : Configurations avancées //Diamètre de la vis @@ -208,6 +212,31 @@ void syringe_pump_callback (Control* sender, int value, void* param) Serial.println(sender->id); } +void switch_push_pull_choice_callback (Control* sender, int value, void* param) +{ + + Serial.println(String("param: ") + String(long(param))); + switch (value) + { + case S_ACTIVE: + ESPUI.print(label_push_pull_choice, "Délivrer"); + + style (position_choice, 1); + style (label_push_pull_choice, 1); + style (switch_push_pull_choice, 1); + + break; + + case S_INACTIVE: + ESPUI.print(label_push_pull_choice, "Recupérer"); + break; + } + + Serial.print(" "); + Serial.println(sender->id); +} + + void syringe_pump_on_off() { if (syringe_filled.is_running()) @@ -219,6 +248,8 @@ void syringe_pump_on_off() } + + void initialisation_callback (Control *sender, int type) { if((type == B_UP)) { diff --git a/web.h b/web.h index 07f2952f494566d9d598cdf9599848e21a94a913..0a8d3a5a1115100f2235caf215b88ad777ef173d 100644 --- a/web.h +++ b/web.h @@ -18,7 +18,7 @@ int status_syringe_pump, status_syringe_filled; -uint16_t activation_syringe_pump, syringe_filled_placement, initialisation, position_choice, label_position_choice, add_syringe, choose_syringe; +uint16_t activation_syringe_pump, syringe_filled_placement, initialisation, position_choice, label_push_pull_choice, switch_push_pull_choice, add_syringe, choose_syringe; uint16_t syringe_selection, syringe_ref, syringe_brand, syringe_volume, syringe_diameter, new_syringe; @@ -92,6 +92,7 @@ void position_choice_callback (Control* sender, int value, void* param); +void switch_push_pull_choice_callback (Control* sender, int value, void* param); void progress_move_callback (Control* sender, int value, void* param);