Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(matter): General Review - remove while(!serial) ipv6(enable) and fixes some commentaries in the code #10732

Merged
merged 4 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,10 @@ void setup() {
pinMode(ledPin, OUTPUT);

Serial.begin(115200);
while (!Serial) {
delay(100);
}

// We start by connecting to a WiFi network
Serial.print("Connecting to ");
Serial.println(ssid);
// enable IPv6
WiFi.enableIPv6(true);
// Manually connect to WiFi
WiFi.begin(ssid, password);
// Wait for connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,10 @@ const char *password = "your-password"; // Change this to your WiFi password

void setup() {
Serial.begin(115200);
while (!Serial) {
delay(100);
}

// We start by connecting to a WiFi network
Serial.print("Connecting to ");
Serial.println(ssid);
// enable IPv6
WiFi.enableIPv6(true);
// Manually connect to WiFi
WiFi.begin(ssid, password);
// Wait for connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,10 @@ void setup() {
pinMode(buttonPin, INPUT_PULLUP);

Serial.begin(115200);
while (!Serial) {
delay(100);
}

// We start by connecting to a WiFi network
Serial.print("Connecting to ");
Serial.println(ssid);
// enable IPv6
WiFi.enableIPv6(true);
// Manually connect to WiFi
WiFi.begin(ssid, password);
// Wait for connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,10 @@ void setup() {
pinMode(ledPin, OUTPUT);

Serial.begin(115200);
while (!Serial) {
delay(100);
}

// We start by connecting to a WiFi network
Serial.print("Connecting to ");
Serial.println(ssid);
// enable IPv6
WiFi.enableIPv6(true);
// Manually connect to WiFi
WiFi.begin(ssid, password);
// Wait for connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,10 @@ void setup() {
pinMode(ledPin, OUTPUT);

Serial.begin(115200);
while (!Serial) {
delay(100);
}

// We start by connecting to a WiFi network
Serial.print("Connecting to ");
Serial.println(ssid);
// enable IPv6
WiFi.enableIPv6(true);
// Manually connect to WiFi
WiFi.begin(ssid, password);
// Wait for connection
Expand Down
5 changes: 0 additions & 5 deletions libraries/Matter/examples/MatterFan/MatterFan.ino
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,10 @@ void setup() {
pinMode(dcMotorPin, OUTPUT);

Serial.begin(115200);
while (!Serial) {
delay(100);
}

// We start by connecting to a WiFi network
Serial.print("Connecting to ");
Serial.println(ssid);
// enable IPv6
WiFi.enableIPv6(true);
// Manually connect to WiFi
WiFi.begin(ssid, password);
// Wait for connection
Expand Down
1 change: 0 additions & 1 deletion libraries/Matter/examples/MatterMinimum/MatterMinimum.ino
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ void setup() {
// Initialize the LED GPIO
pinMode(ledPin, OUTPUT);

WiFi.enableIPv6(true);
// Manually connect to WiFi
WiFi.begin(ssid, password);
// Wait for connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,10 @@ void setup() {
pinMode(ledPin, OUTPUT);

Serial.begin(115200);
while (!Serial) {
delay(100);
}

// We start by connecting to a WiFi network
Serial.print("Connecting to ");
Serial.println(ssid);
// enable IPv6
WiFi.enableIPv6(true);
// Manually connect to WiFi
WiFi.begin(ssid, password);
// Wait for connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,11 @@ void setup() {
pinMode(buttonPin, INPUT_PULLUP);

Serial.begin(115200);
while (!Serial) {
delay(100);
}

// We start by connecting to a WiFi network
Serial.print("Connecting to ");
Serial.println(ssid);
// enable IPv6
WiFi.enableIPv6(true);

// Manually connect to WiFi
WiFi.begin(ssid, password);
// Wait for connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,10 @@ void setup() {
pinMode(ledPin, OUTPUT);

Serial.begin(115200);
while (!Serial) {
delay(100);
}

// We start by connecting to a WiFi network
Serial.print("Connecting to ");
Serial.println(ssid);
// enable IPv6
WiFi.enableIPv6(true);
// Manually connect to WiFi
WiFi.begin(ssid, password);
// Wait for connection
Expand Down
4 changes: 2 additions & 2 deletions libraries/Matter/src/MatterEndpoints/MatterColorLight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ bool MatterColorLight::setOnOff(bool newState) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (onOffState == newState) {
return true;
}
Expand Down Expand Up @@ -256,7 +256,7 @@ bool MatterColorLight::setColorHSV(espHsvColor_t _hsvColor) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (colorHSV.h == _hsvColor.h && colorHSV.s == _hsvColor.s && colorHSV.v == _hsvColor.v) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ bool MatterColorTemperatureLight::setOnOff(bool newState) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (onOffState == newState) {
return true;
}
Expand Down Expand Up @@ -179,7 +179,7 @@ bool MatterColorTemperatureLight::setBrightness(uint8_t newBrightness) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (brightnessLevel == newBrightness) {
return true;
}
Expand Down Expand Up @@ -210,7 +210,7 @@ bool MatterColorTemperatureLight::setColorTemperature(uint16_t newTemperature) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (colorTemperatureLevel == newTemperature) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ bool MatterContactSensor::setContact(bool _contactState) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (contactState == _contactState) {
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/Matter/src/MatterEndpoints/MatterDimmableLight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ bool MatterDimmableLight::setOnOff(bool newState) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (onOffState == newState) {
return true;
}
Expand Down Expand Up @@ -155,7 +155,7 @@ bool MatterDimmableLight::setBrightness(uint8_t newBrightness) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (brightnessLevel == newBrightness) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ bool MatterEnhancedColorLight::setOnOff(bool newState) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (onOffState == newState) {
return true;
}
Expand Down Expand Up @@ -267,7 +267,7 @@ bool MatterEnhancedColorLight::setBrightness(uint8_t newBrightness) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (brightnessLevel == newBrightness) {
return true;
}
Expand Down Expand Up @@ -298,7 +298,7 @@ bool MatterEnhancedColorLight::setColorTemperature(uint16_t newTemperature) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (colorTemperatureLevel == newTemperature) {
return true;
}
Expand Down Expand Up @@ -338,7 +338,7 @@ bool MatterEnhancedColorLight::setColorHSV(espHsvColor_t _hsvColor) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (colorHSV.h == _hsvColor.h && colorHSV.s == _hsvColor.s && colorHSV.v == _hsvColor.v) {
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions libraries/Matter/src/MatterEndpoints/MatterFan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ bool MatterFan::setMode(FanMode_t newMode, bool performUpdate) {
log_w("Matter Fan device has not begun.");
return false;
}
// avoid processing the a "no-change"
// avoid processing if there was no change
if (currentFanMode == newMode) {
return true;
}
Expand Down Expand Up @@ -159,7 +159,7 @@ bool MatterFan::setSpeedPercent(uint8_t newPercent, bool performUpdate) {
log_w("Matter Fan device has not begun.");
return false;
}
// avoid processing the a "no-change"
// avoid processing if there was no change
if (currentPercent == newPercent) {
return true;
}
Expand Down Expand Up @@ -193,7 +193,7 @@ bool MatterFan::setOnOff(bool newState, bool performUpdate) {
log_w("Matter Fan device has not begun.");
return false;
}
// avoid processing the a "no-change"
// avoid processing if there was no change
if (getOnOff() == newState) {
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/Matter/src/MatterEndpoints/MatterHumiditySensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ bool MatterHumiditySensor::setRawHumidity(uint16_t _rawHumidity) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (rawHumidity == _rawHumidity) {
return true;
}
Expand All @@ -98,7 +98,7 @@ bool MatterHumiditySensor::setRawHumidity(uint16_t _rawHumidity) {
bool ret;
ret = updateAttributeVal(RelativeHumidityMeasurement::Id, RelativeHumidityMeasurement::Attributes::MeasuredValue::Id, &humidityVal);
if (!ret) {
log_e("Failed to update Fan Speed Percent Attribute.");
log_e("Failed to update Humidity Sensor Attribute.");
return false;
}
rawHumidity = _rawHumidity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool MatterOccupancySensor::setOccupancy(bool _occupancyState) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (occupancyState == _occupancyState) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/Matter/src/MatterEndpoints/MatterOnOffLight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ bool MatterOnOffLight::setOnOff(bool newState) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (onOffState == newState) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/Matter/src/MatterEndpoints/MatterOnOffPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bool MatterOnOffPlugin::setOnOff(bool newState) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (onOffState == newState) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool MatterPressureSensor::setRawPressure(int16_t _rawPressure) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (rawPressure == _rawPressure) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool MatterTemperatureSensor::setRawTemperature(int16_t _rawTemperature) {
return false;
}

// avoid processing the a "no-change"
// avoid processing if there was no change
if (rawTemperature == _rawTemperature) {
return true;
}
Expand All @@ -86,7 +86,7 @@ bool MatterTemperatureSensor::setRawTemperature(int16_t _rawTemperature) {
bool ret;
ret = updateAttributeVal(TemperatureMeasurement::Id, TemperatureMeasurement::Attributes::MeasuredValue::Id, &temperatureVal);
if (!ret) {
log_e("Failed to update Fan Speed Percent Attribute.");
log_e("Failed to update Temperature Sensor Attribute.");
return false;
}
rawTemperature = _rawTemperature;
Expand Down
Loading