diff --git a/web.cpp b/web.cpp index af9e569413caf5670b187d68be62d91dfe9ab81a..0d6d9b5be69fe66241dfa3731e37ffe82135c32f 100644 --- a/web.cpp +++ b/web.cpp @@ -46,23 +46,23 @@ void web_setup () ESPUI.addControl(ControlType::Separator, "", "", ControlColor::None); //Exchange_values_wanted - initial_volume_mL_label =ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue : ", "Volume initial contenu dans la seringue : ", ControlColor::None, syringe_volume_mL); - initial_volume_mL = ESPUI.addControl( ControlType::Number, "Volume initial contenu dans la seringue : ", "0", ControlColor::None, syringe_volume_mL, initial_volume_mL_callback, (void*)19); + initial_volume_mL_label =ESPUI.addControl( ControlType::Label, "Caractéristiques de la seringue : ", "Volume initial contenu dans la seringue : ", ControlColor::None); + initial_volume_mL = ESPUI.addControl( ControlType::Number, "Volume initial contenu dans la seringue : ", "0", ControlColor::None, initial_volume_mL_label, initial_volume_mL_callback, (void*)19); - volume_exchange_mL_label = ESPUI.addControl(ControlType::Label, "Configuration de l'échange", "Volume à échanger en mL", ControlColor::None); - volume_exchange_mL = ESPUI.addControl(ControlType::Number,"Configuration de l'échange", "", ControlColor::None, volume_exchange_mL_label, volume_exchange_mL_callback, (void*)19); + volume_exchange_mL_label = ESPUI.addControl(ControlType::Label, "Configuration de l'échange", "Volume à échanger en mL", ControlColor::None, initial_volume_mL_label); + volume_exchange_mL = ESPUI.addControl(ControlType::Number,"Configuration de l'échange", "", ControlColor::None, initial_volume_mL_label, volume_exchange_mL_callback, (void*)19); - exchange_throughtput_uL_per_sec_label = ESPUI.addControl(ControlType::Label, "Configuration 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,"Configuration de l'échange", "", ControlColor::None, volume_exchange_mL_label, exchange_throughtput_uL_per_sec_callback, (void*)19); + exchange_throughtput_uL_per_sec_label = ESPUI.addControl(ControlType::Label, "Configuration de l'échange", "Débit de l'échange en uL/sec", ControlColor::None, initial_volume_mL_label); + exchange_throughtput_uL_per_sec = ESPUI.addControl(ControlType::Number,"Configuration de l'échange", "", ControlColor::None, initial_volume_mL_label, exchange_throughtput_uL_per_sec_callback, (void*)19); - label_push_pull_choice = ESPUI.addControl(ControlType::Label, "Injection ou Aspiration", "Injection", ControlColor::None, volume_exchange_mL_label); - switch_push_pull_choice = ESPUI.addControl(ControlType::Switcher, "Injection ou Aspiration", "Injection", ControlColor::None, volume_exchange_mL_label, switch_push_pull_choice_callback, (void*)19); + label_push_pull_choice = ESPUI.addControl(ControlType::Label, "Injection ou Aspiration", "Injection", ControlColor::None, initial_volume_mL_label); + switch_push_pull_choice = ESPUI.addControl(ControlType::Switcher, "Injection ou Aspiration", "Injection", ControlColor::None, initial_volume_mL_label, switch_push_pull_choice_callback, (void*)19); ESPUI.updateSwitcher(switch_push_pull_choice, true); //pour mettre a "Injection" par défaut au début - start_exchange = ESPUI.addControl(ControlType::Button, "Start exchange", "\xF0\x9F\x8F\x81", ControlColor::None, volume_exchange_mL_label, start_exchange_callback, (void*)19); + start_exchange = ESPUI.addControl(ControlType::Button, "Start exchange", "\xF0\x9F\x8F\x81", ControlColor::None, initial_volume_mL_label, start_exchange_callback, (void*)19); //Remaning_values @@ -156,7 +156,7 @@ void stop_syringe_pump_callback (Control* sender, int value, void* param) -Action : Linking the switch of the syringe pump status and the actions. ***/ {(void)param; //Avoid the unused Warning - syringe_pump_off(); + style_syringe_pump_off(); Serial.println("Syringe_pump stopped"); Serial.println(String("ID: ") + sender->id); @@ -174,11 +174,11 @@ void syringe_filled_placement_callback (Control* sender, int value, void* param) switch (value) { case S_ACTIVE: - syringe_filled_placement_on(); + style_syringe_filled_placement_on(); break; case S_INACTIVE: - syringe_filled_placement_off(); + style_syringe_filled_placement_off(); break; } @@ -228,7 +228,7 @@ void fast_backward_callback (Control *sender, int type) case B_UP: - syringe_pump_off(); + style_syringe_pump_off(); break; } @@ -261,7 +261,7 @@ void fast_forward_callback (Control *sender, int type) case B_UP: - syringe_pump_off(); + style_syringe_pump_off(); break; } @@ -292,7 +292,7 @@ void slow_backward_callback (Control *sender, int type) case B_UP: - syringe_pump_off(); + style_syringe_pump_off(); break; } @@ -323,7 +323,7 @@ void slow_forward_callback (Control *sender, int type) case B_UP: - syringe_pump_off(); + style_syringe_pump_off(); break; } @@ -417,15 +417,6 @@ void switch_push_pull_choice_callback (Control* sender, int value, void* param) ESPUI.print(label_push_pull_choice, "Injection"); - style (initial_volume_mL, 1); - style (initial_volume_mL_label, 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); - break; case S_INACTIVE: @@ -434,14 +425,6 @@ void switch_push_pull_choice_callback (Control* sender, int value, void* param) ESPUI.print(label_push_pull_choice, "Aspiration"); - style (initial_volume_mL, 1); - style (initial_volume_mL_label, 1); - 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; } syringe_filled.write_Json(); @@ -479,7 +462,9 @@ void remaining_time_sec_callback (Control* sender, int value, void* param) void start_exchange_callback (Control* sender, int value, void* param) {(void)param; //Avoid the unused Warning - syringe_pump_on(); + + syringe_filled.start_exchange(); + style_syringe_pump_on(); Serial.println("Exchange start"); Serial.println(String("ID: ") + sender->id); @@ -708,76 +693,10 @@ void syringe_pump_on_off() ESPUI.updateControlValue(status_syringe_pump, "0"); } -void syringe_pump_on() -/*** --Argument : / --Return : / --Action : Change the status_syringe_pump label to display the information. - Change the style of the controller involved. - Causes the movement of the syringe pump. -***/ -{ - ESPUI.print(status_syringe_pump, "En marche"); - style (status_syringe_pump, 1); - style (stop_syringe_pump, 1); - syringe_filled.move(); -} - -void syringe_pump_off() -/*** --Argument : / --Return : / --Action : Change the status_syringe_pump label to display the information. - Change the style of the controller involved. - Causes the stop of the syringe pump. -***/ -{ - ESPUI.print(status_syringe_pump, "A l'arrêt"); - style (status_syringe_pump, 2); - style (stop_syringe_pump, 2); - - syringe_filled.stop(); -} - -void syringe_filled_placement_on() -/*** --Argument : / --Return : / --Action : Change the status_syringe_filled label to display the information. - Change the style of the controller involved. - Disable the calibration. -***/ -{ - ESPUI.print(status_syringe_filled, "En place"); - style (status_syringe_filled, 1); - style (syringe_filled_placement, 1); - - ESPUI.setEnabled(calibration, false); - style (calibration, 2); -} - -void syringe_filled_placement_off() -/*** --Argument : / --Return : / --Action : Change the status_syringe_filled label to display the information. - Change the style of the controller involved. - Enable the calibration. -***/ -{ - ESPUI.print(status_syringe_filled, "Enlevée"); - style (status_syringe_filled, 2); - style (syringe_filled_placement, 2); - - ESPUI.setEnabled(calibration, true); - style (calibration, 1); -} - - -/*************OTHER_METHODS****************/ +/*************STYLE_METHODS****************/ void style (uint16_t id, int style) /*** @@ -836,15 +755,15 @@ void set_init_style() style (confirm_initialisation, 3); - style (initial_volume_mL, 1); - style (initial_volume_mL_label, 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); - style (start_exchange, 1); + style (initial_volume_mL, 3); + style (initial_volume_mL_label, 3); + style (volume_exchange_mL_label, 3); + style (volume_exchange_mL, 3); + style (exchange_throughtput_uL_per_sec_label, 3); + style (exchange_throughtput_uL_per_sec, 3); + style (label_push_pull_choice, 3); + style (switch_push_pull_choice, 3); + style (start_exchange, 3); style (label_remaining_volume_mL, 3); @@ -920,6 +839,81 @@ void set_theme(int theme) } } + + +void style_syringe_pump_on() +/*** +-Argument : / +-Return : / +-Action : Change the status_syringe_pump label to display the information. + Change the style of the controller involved. + Causes the movement of the syringe pump. +***/ +{ + ESPUI.print(status_syringe_pump, "En marche"); + style (status_syringe_pump, 1); + style (stop_syringe_pump, 1); + +} + +void style_syringe_pump_off() +/*** +-Argument : / +-Return : / +-Action : Change the status_syringe_pump label to display the information. + Change the style of the controller involved. + Causes the stop of the syringe pump. +***/ +{ + ESPUI.print(status_syringe_pump, "A l'arrêt"); + style (status_syringe_pump, 2); + style (stop_syringe_pump, 2); + + syringe_filled.stop(); +} + +void style_syringe_filled_placement_on() +/*** +-Argument : / +-Return : / +-Action : Change the status_syringe_filled label to display the information. + Change the style of the controller involved. + Disable the calibration. +***/ +{ + ESPUI.print(status_syringe_filled, "En place"); + style (status_syringe_filled, 1); + style (syringe_filled_placement, 1); + + ESPUI.setEnabled(calibration, false); + style (calibration, 2); +} + +void style_syringe_filled_placement_off() +/*** +-Argument : / +-Return : / +-Action : Change the status_syringe_filled label to display the information. + Change the style of the controller involved. + Enable the calibration. +***/ +{ + ESPUI.print(status_syringe_filled, "Enlevée"); + style (status_syringe_filled, 2); + style (syringe_filled_placement, 2); + + ESPUI.setEnabled(calibration, true); + style (calibration, 1); +} + + + + + + + +//OTHER METHODS + void select_syringe_maj(uint16_t tab) /*** -Argument : The page on which the info must display. @@ -955,9 +949,9 @@ void web_loop () //syringe_filled.update_remaining_volume(); if (syringe_filled.is_running()) - syringe_pump_on(); + style_syringe_pump_on(); else - syringe_pump_off(); + style_syringe_pump_off(); } diff --git a/web.h b/web.h index 2604e93d57bf3dcaf1e0288ed8128ed7f3003e14..a0f9a274a3ba2ad8b19ca47563baff0b25c42f8d 100644 --- a/web.h +++ b/web.h @@ -118,18 +118,20 @@ void syringe_selection_callback(Control* sender, int value); //ON_OFF METHODS void syringe_pump_on_off(); -void syringe_pump_on(); -void syringe_pump_off(); -void syringe_filled_placement_on(); -void syringe_filled_placement_off(); - - -//OTHER_METHODS +//STYLE_METHODS void style (uint16_t id, int style); void set_init_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(); + + + +//OTHER_METHODS void select_syringe_maj(uint16_t tab);