Merge pull request #68 from FabLab-Luenen/development

Update to 3.1.0.BETA7
This commit is contained in:
bpohvoodoo
2020-02-02 16:09:29 +01:00
committed by GitHub
15 changed files with 1927 additions and 1869 deletions
+2 -1
View File
@@ -748,7 +748,8 @@ void loop() {
mqtt_client->publish(mqtt_outtopic, qospub, false, mqtt_buf);
#endif
#if defined(ENABLE_HOMEASSISTANT)
if(!ha_send_data.active()) ha_send_data.once(3, tickerSendState);
if(ha_send_data.active()) ha_send_data.detach();
ha_send_data.once(5, tickerSendState);
#endif
#endif
}
+7 -7
View File
@@ -1038,23 +1038,23 @@ uint16_t WS2812FX::mode_sparkle(void) {
/*
* Lights all LEDs in the color. Flashes single white pixels randomly.
* Lights all LEDs in the color. Flashes white pixels randomly.
* Inspired by www.tweaking4all.com/hardware/arduino/arduino-led-strip-effects/
*/
uint16_t WS2812FX::mode_flash_sparkle(void) {
if(SEGMENT_RUNTIME.counter_mode_call == 0) {
for(uint16_t i=SEGMENT.start; i <= SEGMENT.stop; i++) {
setPixelColor(i, SEGMENT.colors[0]);
}
}
setPixelColor(SEGMENT.start + SEGMENT_RUNTIME.aux_param3, SEGMENT.colors[0]);
if(random8(5) == 0) {
SEGMENT_RUNTIME.aux_param3 = random16(SEGMENT_LENGTH); // aux_param3 stores the random led index
setPixelColor(SEGMENT.start + SEGMENT_RUNTIME.aux_param3, WHITE);
uint8_t size = 1 << SIZE_OPTION;
uint16_t index = SEGMENT.start + random16(SEGMENT_LENGTH - size);
for(uint8_t j=0; j<size; j++) {
setPixelColor(index + j, WHITE);
}
return 20;
}
return SEGMENT.speed;
}
+5
View File
@@ -5,6 +5,11 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="mobile-web-app-capable" content="yes">
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Wed, 01 Jan 2020 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<style>
Binary file not shown.
+3 -2
View File
@@ -20,14 +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 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 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
+5
View File
@@ -2,6 +2,11 @@
bool readSegmentStateFS(uint8_t _seg);
// End Prototypes
void getACK(char *buffer) {
server.sendHeader("Access-Control-Allow-Origin", "*");
server.send(200, "text/plain", buffer );
}
// Call convertColors whenever main_color, back_color or xtra_color changes.
void convertColors() {
hexcolors_trans[0] = (uint32_t)(main_color.white << 24) | (main_color.red << 16) | (main_color.green << 8) | main_color.blue;
File diff suppressed because it is too large Load Diff
+18 -9
View File
@@ -432,11 +432,13 @@ void checkpayload(uint8_t * _payload, bool mqtt = false, uint8_t num = 0) {
}
#if defined(ENABLE_STATE_SAVE)
if (_updateState) {
if(!save_state.active()) save_state.once(3, tickerSaveState);
if(save_state.active()) save_state.detach();
save_state.once(3, tickerSaveState);
}
if (_updateSegState) {
State.mode = SET;
if(!save_seg_state.active()) save_seg_state.once(3, tickerSaveSegmentState);
if(save_seg_state.active()) save_seg_state.detach();
save_seg_state.once(3, tickerSaveSegmentState);
}
_updateState = false;
@@ -547,10 +549,12 @@ void checkpayload(uint8_t * _payload, bool mqtt = false, uint8_t num = 0) {
}
#if defined(ENABLE_STATE_SAVE)
if (_updateStrip || _updateConfig) {
if(!save_conf.active()) save_conf.once(3, tickerSaveConfig);
if(save_conf.active()) save_conf.detach();
save_conf.once(3, tickerSaveConfig);
}
if (_updateState) {
if(!save_state.active()) save_state.once(3, tickerSaveState);
if(save_state.active()) save_state.detach();
save_state.once(3, tickerSaveState);
}
#endif
_updateStrip = false;
@@ -863,11 +867,13 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght
}
#if defined(ENABLE_STATE_SAVE)
if (_updateState) {
if(!save_state.active()) save_state.once(3, tickerSaveState);
if(save_state.active()) save_state.detach();
save_state.once(3, tickerSaveState);
}
if (_updateSegState) {
State.mode = SET;
if(!save_seg_state.active()) save_seg_state.once(3, tickerSaveSegmentState);
if(save_seg_state.active()) save_seg_state.detach();
save_seg_state.once(3, tickerSaveSegmentState);
}
#endif
_updateState = false;
@@ -894,7 +900,8 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght
if (!processJson((char*)payload)) {
return;
}
if(!ha_send_data.active()) ha_send_data.once(5, tickerSendState);
if(ha_send_data.active()) ha_send_data.detach();
ha_send_data.once(5, tickerSendState);
} else if (strcmp(topic, mqtt_intopic) == 0) {
#endif
@@ -1514,11 +1521,13 @@ void handleRemote() {
}
#if defined(ENABLE_STATE_SAVE)
if (_updateState) {
if(!save_state.active()) save_state.once(3, tickerSaveState);
if(save_state.active()) save_state.detach();
save_state.once(3, tickerSaveState);
}
if (_updateSegState) {
State.mode = SET;
if(!save_seg_state.active()) save_seg_state.once(3, tickerSaveSegmentState);
if(save_seg_state.active()) save_seg_state.detach();
save_seg_state.once(3, tickerSaveSegmentState);
}
#endif
_updateState = false;
+31 -15
View File
@@ -136,8 +136,8 @@ server.on("/get_switch", []() {
});
server.on("/get_color", []() {
char rgbcolor[10];
snprintf(rgbcolor, sizeof(rgbcolor), "%02X%02X%02X%02X", main_color.white, main_color.red, main_color.green, main_color.blue);
char rgbcolor[7];
snprintf(rgbcolor, sizeof(rgbcolor), "%02X%02X%02X", main_color.red, main_color.green, main_color.blue);
rgbcolor[sizeof(rgbcolor) - 1] = 0x00;
server.sendHeader("Access-Control-Allow-Origin", "*");
server.send(200, "text/plain", rgbcolor);
@@ -145,8 +145,18 @@ server.on("/get_color", []() {
DBG_OUTPUT_PORT.println(rgbcolor);
});
server.on("/get_color1", []() {
char rgbcolor[9];
snprintf(rgbcolor, sizeof(rgbcolor), "%02X%02X%02X%02X", main_color.white, main_color.red, main_color.green, main_color.blue);
rgbcolor[sizeof(rgbcolor) - 1] = 0x00;
server.sendHeader("Access-Control-Allow-Origin", "*");
server.send(200, "text/plain", rgbcolor );
DBG_OUTPUT_PORT.print("/get_color1: ");
DBG_OUTPUT_PORT.println(rgbcolor);
});
server.on("/get_color2", []() {
char rgbcolor[10];
char rgbcolor[9];
snprintf(rgbcolor, sizeof(rgbcolor), "%02X%02X%02X%02X", back_color.white, back_color.red, back_color.green, back_color.blue);
rgbcolor[sizeof(rgbcolor) - 1] = 0x00;
server.sendHeader("Access-Control-Allow-Origin", "*");
@@ -156,7 +166,7 @@ server.on("/get_color2", []() {
});
server.on("/get_color3", []() {
char rgbcolor[10];
char rgbcolor[9];
snprintf(rgbcolor, sizeof(rgbcolor), "%02X%02X%02X%02X", xtra_color.white, xtra_color.red, xtra_color.green, xtra_color.blue);
rgbcolor[sizeof(rgbcolor) - 1] = 0x00;
server.sendHeader("Access-Control-Allow-Origin", "*");
@@ -294,10 +304,12 @@ server.on("/config", []() {
#if defined(ENABLE_STATE_SAVE)
if (_updateStrip || _updateConfig) {
if(!save_conf.active()) save_conf.once(3, tickerSaveConfig);
if(save_conf.active()) save_conf.detach();
save_conf.once(3, tickerSaveConfig);
}
if (_updateState) {
if(!save_state.active()) save_state.once(3, tickerSaveState);
if(save_state.active()) save_state.detach();
save_state.once(3, tickerSaveState);
}
#endif
_updateStrip = false;
@@ -308,21 +320,23 @@ server.on("/config", []() {
server.on("/off", []() {
if (State.mode == OFF) { State.mode = SET; } else { State.mode = OFF; };
getStateJSON();
getACK("OK");
#if defined(ENABLE_STATE_SAVE)
if(!save_state.active()) save_state.once(3, tickerSaveState);
if(save_state.active()) save_state.detach();
save_state.once(3, tickerSaveState);
#endif
});
server.on("/on", []() {
if (prevmode == OFF) {
State.mode = SET;
getStateJSON();
getACK("OK");
#if defined(ENABLE_STATE_SAVE)
if(!save_state.active()) save_state.once(3, tickerSaveState);
if(save_state.active()) save_state.detach();
save_state.once(3, tickerSaveState);
#endif
} else {
getStateJSON();
getACK("NOK");
}
});
@@ -482,16 +496,18 @@ server.on("/set", []() {
State.mode = SET;
_updateState = true;
}
DBG_OUTPUT_PORT.printf("Get Args: %s\r\n", listStateJSONfull());
getStateJSON();
//DBG_OUTPUT_PORT.printf("Get Args: %s\r\n", listStateJSONfull()); //possibly causing heap problems
getACK("OK");
#if defined(ENABLE_STATE_SAVE)
if (_updateState) {
if(!save_state.active()) save_state.once(3, tickerSaveState);
if(save_state.active()) save_state.detach();
save_state.once(3, tickerSaveState);
}
if (_updateSegState) {
State.mode = SET;
if(!save_seg_state.active()) save_seg_state.once(3, tickerSaveSegmentState);
if(save_seg_state.active()) save_seg_state.detach();
save_seg_state.once(3, tickerSaveSegmentState);
}
#endif
_updateState = false;
+3
View File
@@ -70,6 +70,9 @@ bool handleFileRead(String path) {
path += ".gz";
File file = SPIFFS.open(path, "r");
server.sendHeader("Access-Control-Allow-Origin", "*");
server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate");
server.sendHeader("Pragma", "no-cache");
server.sendHeader("Expires", "-1");
size_t sent = server.streamFile(file, contentType);
file.close();
return true;
+1 -1
View File
@@ -1 +1 @@
#define SKETCH_VERSION "3.1.0.BETA6"
#define SKETCH_VERSION "3.1.0.BETA7"
+5
View File
@@ -247,4 +247,9 @@
* known problems:
* Homeassistant will allways use active segment
* E1.31 is only working for one segment at the moment
*
* 27 January
* Version Bump to 3.1.0.BETA7
* small API changes
* work to solve heap problems
*/
+2 -2
View File
@@ -16,7 +16,7 @@
"switch": {
"status": "http://<ESP_HOST>/get_switch",
"powerOn": "http://<ESP_HOST>/all?r=255&g=255&b=255",
"powerOn": "http://<ESP_HOST>/on",
"powerOff": "http://<ESP_HOST>/off"
},
@@ -27,7 +27,7 @@
"color": {
"status": "http://<ESP_HOST>/get_color",
"url": "http://<ESP_HOST>/set?m=0?rgb=%s",
"url": "http://<ESP_HOST>/set?m=0?rgb=00%s",
"brightness": true
}
}
+5
View File
@@ -5,6 +5,11 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="mobile-web-app-capable" content="yes">
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Wed, 01 Jan 2020 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<style>
Binary file not shown.