|
@@ -30,23 +30,13 @@ public:
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- void send() {
|
|
|
- for (int i = 1; i <= 5; i++) {
|
|
|
- LightControlPayload data = LightControlPayload();
|
|
|
- data.id = i;
|
|
|
- data.brightness = 1;
|
|
|
- data.on = false;
|
|
|
- data.timer = 0;
|
|
|
-
|
|
|
- esp_err_t result = esp_now_send(broadcastAddress, (uint8_t*)&data, sizeof(data));
|
|
|
- if (result == ESP_OK)
|
|
|
- Serial.println("Sent with success");
|
|
|
- else {
|
|
|
- Serial.println("Error sending the data");
|
|
|
- Serial.println(esp_err_to_name(result));
|
|
|
- }
|
|
|
-
|
|
|
- delay(100);
|
|
|
+ void send(LightControlPayload data) {
|
|
|
+ esp_err_t result = esp_now_send(broadcastAddress, (uint8_t*)&data, sizeof(data));
|
|
|
+ if (result == ESP_OK)
|
|
|
+ Serial.println("Sent with success");
|
|
|
+ else {
|
|
|
+ Serial.println("Error sending the data");
|
|
|
+ Serial.println(esp_err_to_name(result));
|
|
|
}
|
|
|
}
|
|
|
};
|