pump.h 962 Bytes
#ifndef __PUMP_H_
#define __PUMP_H_

#include <string.h>
#include "pcf.h"
#include "mqtt.h"

// Number = pcfPIN - one action per pin / no diode crap anymore
#define dive  1
#define diaphragm 2
#define peristaltic 3
#define peristaltic_reverse 4

#define src_valve_pump 5
#define dst_valve_rotate 6
#define dst_valve_flower 7u

#define off 0

struct sequence {
  struct action *action;
  int pump;
  int src_valve;
  int dst_valve;
  double start;
  double end;
  struct sequence *next;
};

struct sequence *sequence_head = NULL;
struct sequence *sequence_tail = NULL;

const int startpumpheight = 50;
const int stoppumpheight = 5;

int waterlevel = 0;
unsigned int pumpstate = 0;
unsigned long timeStored = 0;


int pump_start(struct action *ptr);
int pump_start(struct button *ptr);
void pump_running(int remaining);
void pump_end(struct action *ptr);
void pump_end(struct button *ptr);
void pump_end(int source);
void set_relay(struct sequence *step);

#endif