sidoh / esp8266_milight_hub

Replacement for a Milight/LimitlessLED hub hosted on an ESP8266
MIT License
939 stars 220 forks source link

Fix color transition memory leak #715

Closed MunkeyBalls closed 3 years ago

MunkeyBalls commented 3 years ago

Fix for a memory leak which could occur when a light does a color transition to itself.

Example of a transition being stuck:

{
  "transitions": [
    {
      "id": 1520,
      "period": 4294967295,
      "last_sent": 0,
      "bulb": {
        "device_id": 1,
        "group_id": 1,
        "device_type": "rgb_cct"
      },
      "type": "color",
      "current_color": [
        255,
        167,
        91
      ],
      "end_color": [
        255,
        167,
        91
      ],
      "step_sizes": [
        0,
        0,
        0
      ]
    },
}

600 #523

MunkeyBalls commented 3 years ago

Still testing, but first impressions are good. No transitions stuck yet after a few hours of use. Free-heap seems stable as well.

sidoh commented 3 years ago

Sweet! Can we remove finished all together?

Think this would be updating the condition to just check if (isFinished()) and removing finished from the header and constructor.

sidoh commented 3 years ago

Looks great! just the styling comment and should be good to merge.

Thanks for looking into this!

MunkeyBalls commented 3 years ago

No worries, happy to help and this means I can finally run the latest version :)