#include "avrIOhelper/io-helper.h"

#include "mqtt.h"
extern Client mqtt_client;

void do_pumpe(){
        if(read_Input(BTN_BECKEN_FUELLEN, RISING)){
            set_Output(OUT_PUMPE_STARTSTOP, 1);
            set_Output(OUT_PUMPE_PWM, 1);
            set_Output(OUT_VENTIL_ABLASS, 0);
            set_Output(OUT_VENTIL_PUMPE, 0);
            set_Output(LED_PUMPE_AN, 1);
            send_value(&mqtt_client, "/Filamentanlage/02_Wasserbecken/state/pumpe_warm", 1);
        }

        if(read_Input(BTN_BECKEN_LEEREN, RISING)){
            set_Output(OUT_PUMPE_STARTSTOP, 0);
            set_Output(OUT_PUMPE_PWM, 0);
            set_Output(OUT_VENTIL_ABLASS, 1);
            set_Output(OUT_VENTIL_PUMPE, 1);
            set_Output(LED_PUMPE_AN, 0);
            send_value(&mqtt_client, "/Filamentanlage/02_Wasserbecken/state/pumpe_warm", 0);
        }
        if(read_Input(BTN_SLAVE_BECKEN_FUELLEN, RISING)){
            set_Output(OUT_SLAVE_PUMPE_STARTSTOP, 1);
            set_Output(OUT_SLAVE_PUMPE_PWM, 1);
            //set_Output(OUT_VENTIL_ABLASS, 0);
            //set_Output(OUT_VENTIL_PUMPE, 0);
            set_Output(LED_SLAVE_PUMPE_AN, 1);
            send_value(&mqtt_client, "/Filamentanlage/03_Wasserbecken/state/pumpe_warm", 1);
        }

        if(read_Input(BTN_SLAVE_BECKEN_LEEREN, RISING)){
            set_Output(OUT_SLAVE_PUMPE_STARTSTOP, 0);
            set_Output(OUT_SLAVE_PUMPE_PWM, 0);
            //set_Output(OUT_VENTIL_ABLASS, 1);
            //set_Output(OUT_VENTIL_PUMPE, 1);
            set_Output(LED_SLAVE_PUMPE_AN, 0);
            send_value(&mqtt_client, "/Filamentanlage/03_Wasserbecken/state/pumpe_warm", 0);
        }
}
