|
@@ -32,28 +32,28 @@ void halInit(void) {
|
|
|
pinMode(RELAIS_HEAT, OUTPUT);
|
|
|
pinMode(RELAIS_PUMP, OUTPUT);
|
|
|
pinMode(RELAIS_POWER, OUTPUT);
|
|
|
- pinMode(PRESSURE_CTRL, INPUT);
|
|
|
- pinMode(PROXIMITY_SENSOR, INPUT);
|
|
|
- pinMode(INT0, INPUT);
|
|
|
- pinMode(INT1, INPUT);
|
|
|
- pinMode(FLOW, INPUT);
|
|
|
- if (wiringPiISR(INT0, INT_EDGE_BOTH, &halInt0) < 0) {
|
|
|
+ pinMode(PIN_PRESSURE_CTRL, INPUT);
|
|
|
+ pinMode(PIN_PROXIMITY_SENSOR, INPUT);
|
|
|
+ pinMode(PIN_INT0, INPUT);
|
|
|
+ pinMode(PIN_INT1, INPUT);
|
|
|
+ pinMode(PIN_FLOW, INPUT);
|
|
|
+ if (wiringPiISR(PIN_INT0, INT_EDGE_BOTH, &halInt0) < 0) {
|
|
|
logger_error("Unable to setup ISR0: %s\n", strerror(errno));
|
|
|
return;
|
|
|
}
|
|
|
- if (wiringPiISR(INT1, INT_EDGE_BOTH, &halInt1) < 0) {
|
|
|
+ if (wiringPiISR(PIN_INT1, INT_EDGE_BOTH, &halInt1) < 0) {
|
|
|
logger_error("Unable to setup ISR1: %s\n", strerror(errno));
|
|
|
return;
|
|
|
}
|
|
|
- if (wiringPiISR(FLOW, INT_EDGE_FALLING, &halIntFlow) < 0) {
|
|
|
+ if (wiringPiISR(PIN_FLOW, INT_EDGE_FALLING, &halIntFlow) < 0) {
|
|
|
logger_error("Unable to setup ISRFLOW: %s\n", strerror(errno));
|
|
|
return;
|
|
|
}
|
|
|
- if(wiringPiISR(PRESSURE_CTRL, INT_EDGE_BOTH, &halIntPressure) < 0) {
|
|
|
+ if(wiringPiISR(PIN_PRESSURE_CTRL, INT_EDGE_BOTH, &halIntPressure) < 0) {
|
|
|
logger_error("Unable to setup ISRPressure: %s\n", strerror(errno));
|
|
|
return;
|
|
|
}
|
|
|
- if(wiringPiISR(PROXIMITY_SENSOR, INT_EDGE_BOTH, &halIntProximity) < 0) {
|
|
|
+ if(wiringPiISR(PIN_PROXIMITY_SENSOR, INT_EDGE_BOTH, &halIntProximity) < 0) {
|
|
|
logger_error("Unable to setup ISRProximity: %s\n", strerror(errno));
|
|
|
return;
|
|
|
}
|
|
@@ -108,6 +108,9 @@ int halGetRelaisState(int relais) {
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Interrupt routine for Int0 (bottom button)
|
|
|
+ */
|
|
|
void halInt0(void) {
|
|
|
logger(V_BASIC, "Int0 triggered\n");
|
|
|
if (halGetInt0()) {
|
|
@@ -117,6 +120,9 @@ void halInt0(void) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Interrupt routine for Int1 (top button)
|
|
|
+ */
|
|
|
void halInt1(void) {
|
|
|
logger(V_BASIC, "Int1 triggered\n");
|
|
|
if (halGetInt1()) {
|
|
@@ -126,6 +132,10 @@ void halInt1(void) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Interrupt routine for the flow sensor
|
|
|
+ * It counts the edgdes and stores the value in flowcnt
|
|
|
+ */
|
|
|
void halIntFlow(void) {
|
|
|
//halRelaisOff(RELAIS_POWER);
|
|
|
logger(V_BASIC, "IntFlow triggered #%d total: %.2fml\n", flowcnt, halGetFlow());
|
|
@@ -138,7 +148,7 @@ void halIntFlow(void) {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Method to handle toggle of the pressure control
|
|
|
+ * Interrupt routine for the pressure control
|
|
|
*/
|
|
|
void halIntPressure(void) {
|
|
|
logger(V_BASIC, "IntPressure Control triggered\n");
|
|
@@ -180,7 +190,7 @@ void halResetFlow(void){
|
|
|
* @return 0 for closed Pressure Control(heating) and 1 for open
|
|
|
*/
|
|
|
bool halIsHeating(void) {
|
|
|
- if(digitalRead(PRESSURE_CTRL) == 0){
|
|
|
+ if(digitalRead(PIN_PRESSURE_CTRL) == 0){
|
|
|
return true;
|
|
|
} else {
|
|
|
return false;
|
|
@@ -205,7 +215,7 @@ bool halProxSensorCovered(void){
|
|
|
* @return LOW or HIGH
|
|
|
*/
|
|
|
int halGetInt0(void){
|
|
|
- return digitalRead(INT0);
|
|
|
+ return digitalRead(PIN_INT0);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -213,7 +223,7 @@ int halGetInt0(void){
|
|
|
* @return LOW or HIGH
|
|
|
*/
|
|
|
int halGetInt1(void){
|
|
|
- return digitalRead(INT1);
|
|
|
+ return digitalRead(PIN_INT1);
|
|
|
}
|
|
|
|
|
|
/**
|