Skip to content

Commit

Permalink
Version Bump to 3.1.1
Browse files Browse the repository at this point in the history
 * bugfixes regarding issue #80
  • Loading branch information
bpohvoodoo committed Apr 18, 2020
1 parent 712d504 commit 048a938
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Arduino/McLighting/McLighting.ino
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ void loop() {
#endif
#if defined(ENABLE_HOMEASSISTANT)
if(ha_send_data.active()) ha_send_data.detach();
ha_send_data.once(5, tickerSendState);
ha_send_data.once(DELAY_MQTT_HA_MESSAGE, tickerSendState);
#endif
#endif
}
Expand Down
8 changes: 4 additions & 4 deletions Arduino/McLighting/definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ char HOSTNAME[65] = "McLightingRGBW"; // Friedly hostname is configurable just
//#define ENABLE_MQTT_INCLUDE_IP // uncomment/comment to add the IP-adress to the MQTT message
#define ENABLE_HOMEASSISTANT // If defined, enable Homeassistant integration, ENABLE_MQTT must be active
#define MQTT_HOME_ASSISTANT_SUPPORT // If defined, use AMQTT and select Tools -> IwIP Variant -> Higher Bandwidth
//#define DISABLE_MQTT_OUT_ON_MQTT_IN // If defined, McLighting will not send back MQTT-out on MQTT-in regarding issue #67, does not change anything at the moment
#define DELAY_MQTT_HA_MESSAGE 5 // HA Status is send after DELAY_MQTT_HA_MESSAGE seconds, to save bandwith

//#define ENABLE_BUTTON 14 // If defined, enable button handling code, see: https://github.com/toblum/McLighting/wiki/Button-control, the value defines the input pin (14 / D5) for switching the LED strip on / off, connect this PIN to ground to trigger button.
//#define ENABLE_BUTTON_GY33 12 // If defined, enable button handling code for GY-33 color sensor to scan color. The value defines the input pin (12 / D6) for read color data with RGB sensor, connect this PIN to ground to trigger button.
//#define POWER_SUPPLY 12 // PIN (12 / D6) If defined, enable output to control external power supply
#if defined(POWER_SUPPLY)
#define POWER_ON HIGH // Define the output state to turn on the power supply, either HIGH or LOW. Opposite will be uses for power off.
#endif
#define ENABLE_REMOTE 13 // If defined, enable Remote Control via TSOP31238. The value defines the input pin (13 / D7) for TSOP31238 Out
//#define ENABLE_REMOTE 13 // If defined, enable Remote Control via TSOP31238. The value defines the input pin (13 / D7) for TSOP31238 Out

#if defined(ENABLE_BUTTON_GY33)
#define GAMMA 2.5 // Gamma correction for GY-33 sensor
Expand Down Expand Up @@ -178,10 +178,10 @@ struct {
uint8_t pin = 3;
#endif
#if USE_WS2812FX_DMA == 1
uint8_t pin = 2;
uint8_t pin = 1;
#endif
#if USE_WS2812FX_DMA == 2
uint8_t pin = 1;
uint8_t pin = 2;
#endif
#else
uint8_t pin = LED_PIN;
Expand Down
12 changes: 8 additions & 4 deletions Arduino/McLighting/request_handlers.h
Original file line number Diff line number Diff line change
Expand Up @@ -743,11 +743,15 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght
root["effect"] = strip->getModeName(strip->getMode());
}
#endif
char buffer[measureJson(root) + 1];
uint16_t msg_len = measureJson(root) + 1;
char buffer[msg_len];
serializeJson(root, buffer, sizeof(buffer));
jsonBuffer.clear();
#if ENABLE_MQTT == 0
mqtt_client->publish(mqtt_ha_state_out, buffer, true);
//mqtt_client->publish(mqtt_ha_state_out, buffer, true);
mqtt_client->beginPublish(mqtt_ha_state_out, msg_len-1, true);
mqtt_client->write((const uint8_t*)buffer, msg_len-1);
mqtt_client->endPublish();
DBG_OUTPUT_PORT.printf("MQTT: Send [%s]: %s\r\n", mqtt_ha_state_out, buffer);
#endif
#if ENABLE_MQTT == 1
Expand Down Expand Up @@ -901,7 +905,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght
return;
}
if(ha_send_data.active()) ha_send_data.detach();
ha_send_data.once(5, tickerSendState);
ha_send_data.once(DELAY_MQTT_HA_MESSAGE, tickerSendState);
} else if (strcmp(topic, mqtt_intopic) == 0) {
#endif

Expand Down Expand Up @@ -936,7 +940,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght
#if defined(ENABLE_HOMEASSISTANT)
ha_send_data.detach();
mqtt_client->subscribe(mqtt_ha_state_in, qossub);
ha_send_data.once(5, tickerSendState);
ha_send_data.once(DELAY_MQTT_HA_MESSAGE, tickerSendState);
#if defined(MQTT_HOME_ASSISTANT_SUPPORT)
const size_t bufferSize = JSON_ARRAY_SIZE(strip->getModeCount()+ 4) + JSON_OBJECT_SIZE(11) + 1500;
DynamicJsonDocument jsonBuffer(bufferSize);
Expand Down
2 changes: 1 addition & 1 deletion Arduino/McLighting/version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define SKETCH_VERSION "3.1.0"
#define SKETCH_VERSION "3.1.1"
4 changes: 4 additions & 0 deletions Arduino/McLighting/version_info.ino
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,8 @@
* Version Bump to 3.1.0
* bugfixes
* E1.31 is now working for multi segments
*
* 18 April 2020
* Version Bump to 3.1.1
* bugfixes regarding issue #80
*/

0 comments on commit 048a938

Please sign in to comment.