Skip to content
Snippets Groups Projects
web.cpp 37 KiB
Newer Older
{
    ESPUI.print(status_syringe_pump, "En marche");
    style (status_syringe_pump, 1);
    style (stop_syringe_pump, 1);

}

/***
-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 Web :: 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_placement, "En place");
    style (status_syringe_filled_placement, 1);
    style (syringe_filled_placement, 1);
    
    ESPUI.setEnabled(calibration, false);
    style (calibration, 2);
}

void Web :: 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_placement, "Enlevée");
    style (status_syringe_filled_placement, 2);
    style (syringe_filled_placement, 2);

    ESPUI.setEnabled(calibration, true);
    style (calibration, 1);
}


void Web :: style_initialisation(int style_choice)
{
    style (fast_forward, style_choice);
    style (fast_backward, style_choice);
    style (slow_forward, style_choice);
    style (slow_backward, style_choice);
    style (confirm_initialisation, style_choice);
}
void Web :: style_exchange_configuration(int style_choice)
{
    style (initial_volume_mL, style_choice);
    style (initial_volume_mL_label, style_choice);
    style (volume_exchange_mL_label, style_choice);
    style (volume_exchange_mL, style_choice); 
Malaurie Bernard's avatar
Malaurie Bernard committed
    style (exchange_throughtput_uL_per_min_or_duration_sec_label, style_choice);
    style (exchange_throughtput_uL_per_min_or_duration_sec, style_choice);
    style (label_push_pull_choice, style_choice);
    style (switch_push_pull_choice, style_choice);
    style (start_exchange, style_choice);
}
Malaurie Bernard's avatar
Malaurie Bernard committed
void Web :: select_syringe_update(uint16_t tab)
/***
-Argument : The page on which the info must display.
-Return   : /
-Action   : Read the syringe_json file so it get/recover all the syringe models registered.
***/
{
    JsonObject root = syringe.get_syringe_database_object();

    for (JsonPair kv : root) 
    {
        uint16_t choice = ESPUI.addControl(ControlType::Option, kv.key().c_str(), kv.key().c_str(), ControlColor::None, syringe_selection);
        style (choice, 3);
Malaurie Bernard's avatar
Malaurie Bernard committed
        options_id[option_nb] = choice;
        option_nb++;
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 Web :: motor_release_action()
{
    if (syringe_filled.get_motor_release())
    {
        digitalWrite(SLEEP, LOW);
    }
    else
        digitalWrite(SLEEP, HIGH);
}

void Web :: serial_print (String name, Control* sender)
{
    Serial.println(name);
    Serial.println(String("Value: ") + String(sender->type));
    Serial.println(String("ID: ") + sender->id);
    Serial.println("");
}


Malaurie Bernard's avatar
Malaurie Bernard committed
//WEB_LOOP//
Malaurie Bernard's avatar
Malaurie Bernard committed
#if 0
	if(millis() > last_time + 4) {
        //ESPUI.updateSlider(remaining_volume_mL, syringe_filled.step_to_mm(syringe_filled.where_step()*100/syringe_filled.get_syringe_pump_length_mm()));

        if (syringe_filled.is_running()==false)
        style_syringe_pump_off();
Malaurie Bernard's avatar
Malaurie Bernard committed
        syringe_filled.set_update_remaining_volume(false);

        if (syringe_filled.get_motor_release())
            digitalWrite(SLEEP, LOW);
Malaurie Bernard's avatar
Malaurie Bernard committed
            ESPUI.print(status_limit_switch, "On");
            style (status_limit_switch, 2);
Malaurie Bernard's avatar
Malaurie Bernard committed
            ESPUI.print(status_limit_switch, "Off");
            style (status_limit_switch, 1);
Malaurie Bernard's avatar
Malaurie Bernard committed

        if (syringe_filled.get_update_remaining_volume())
            ESPUI.updateSlider(remaining_volume_mL, syringe_filled.get_remaining_volume_mL() + syringe_filled.mm_to_volume(syringe_filled.step_to_mm(syringe_filled.where_step())));

Malaurie Bernard's avatar
Malaurie Bernard committed
#endif
David Gauchard's avatar
David Gauchard committed
}