add function that gets called before homie initialization
This commit is contained in:
parent
6d0cf8f786
commit
bfd74e61a1
@ -28,3 +28,17 @@ Device* devices[] = {
|
||||
&deviceLedW2,
|
||||
&deviceRgb,
|
||||
};
|
||||
|
||||
void hardwareSetup() {
|
||||
pinMode(PIN_LED1, OUTPUT);
|
||||
pinMode(PIN_LED2, OUTPUT);
|
||||
pinMode(PIN_RGB_RED, OUTPUT);
|
||||
pinMode(PIN_RGB_GREEN, OUTPUT);
|
||||
pinMode(PIN_RGB_BLUE, OUTPUT);
|
||||
analogWrite(PIN_LED1, 100);
|
||||
analogWrite(PIN_LED2, 0);
|
||||
analogWrite(PIN_RGB_RED, 0);
|
||||
analogWrite(PIN_RGB_GREEN, 0);
|
||||
analogWrite(PIN_RGB_BLUE, 0);
|
||||
deviceLedW1.ledBrightnessHandler("{\"brightness\":100}");
|
||||
}
|
||||
|
@ -28,3 +28,5 @@ Device* devices[] = {
|
||||
&deviceLdr,
|
||||
&deviceButton,
|
||||
};
|
||||
|
||||
void hardwareSetup() {};
|
||||
|
@ -35,3 +35,5 @@ Device* devices[] = {
|
||||
&deviceButton,
|
||||
&deviceDht,
|
||||
};
|
||||
|
||||
void hardwareSetup() {};
|
||||
|
@ -46,3 +46,5 @@ Device* devices[] = {
|
||||
&deviceIrRx,
|
||||
&deviceIrTx,
|
||||
};
|
||||
|
||||
void hardwareSetup() {};
|
||||
|
@ -20,6 +20,7 @@ void loopHandler() {
|
||||
}
|
||||
|
||||
void setup() {
|
||||
hardwareSetup();
|
||||
Homie.setFirmware(FWNAME, FWVERSION);
|
||||
for (int i = 0; i < sizeof(devices) / sizeof(*devices); i++) {
|
||||
devices[i]->deviceRegister();
|
||||
|
Loading…
Reference in New Issue
Block a user