25 lines
516 B
C++
25 lines
516 B
C++
#include <Arduino.h>
|
|
#include "config.h"
|
|
#include "app_config.h"
|
|
#include "relays.h"
|
|
|
|
RelayState relays;
|
|
|
|
void initRelays() {
|
|
for (int i = 0; i < MAX_RELAYS; i++) {
|
|
if (appConfig.relays[i].available) {
|
|
pinMode(appConfig.relays[i].pin, OUTPUT);
|
|
}
|
|
}
|
|
|
|
updateRelayOutputs();
|
|
}
|
|
|
|
void updateRelayOutputs() {
|
|
for (int i = 0; i < MAX_RELAYS; i++) {
|
|
if (appConfig.relays[i].available) {
|
|
digitalWrite(appConfig.relays[i].pin, relays.state[i]);
|
|
}
|
|
}
|
|
}
|