Merge pull request #52 from FabLab-Luenen/development

Version Bump to 3.1.0.BETA4
This commit is contained in:
bpohvoodoo
2019-10-25 18:49:58 +02:00
committed by GitHub
17 changed files with 8333 additions and 1759 deletions
+15 -7
View File
@@ -16,7 +16,6 @@
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
#include <FS.h>
#include <WiFiClient.h>
#include <ESP8266mDNS.h>
#include <WebSockets.h> //https://github.com/Links2004/arduinoWebSockets
#include <WebSocketsServer.h>
@@ -35,6 +34,7 @@
// ***************************************************************************
// Load libraries for PubSubClient
// ***************************************************************************
#include <WiFiClient.h>
#include <PubSubClient.h>
WiFiClient espClient;
PubSubClient * mqtt_client;
@@ -77,7 +77,8 @@
#if defined(USE_HTML_MIN_GZ)
#include "htm_index_gz.h"
#include "htm_edit_gz.h"
#include "htm_edit_gz.h"
#include "html_material_icons.h"
#endif
@@ -433,8 +434,8 @@ void setup() {
if (!wifiManager.autoConnect(HOSTNAME)) {
DBG_OUTPUT_PORT.println("failed to connect and hit timeout");
//reset and try again, or maybe put it to deep sleep
ESP.reset(); //Will be removed when upgrading to standalone offline McLightingUI version
delay(1000); //Will be removed when upgrading to standalone offline McLightingUI version
//ESP.reset(); //Will be removed when upgrading to standalone offline McLightingUI version
//delay(1000); //Will be removed when upgrading to standalone offline McLightingUI version
}
//save the custom parameters to FS/EEPROM
@@ -717,7 +718,12 @@ void loop() {
if(!strip->isRunning()) strip->start();
strip->service();
for (uint8_t i = 0; i < Config.segments; i++) {
if (segState.mode[i] == FX_MODE_CUSTOM_0) { handleAutoPlay(i); };
if (segState.mode[i] == FX_MODE_CUSTOM_0) { handleAutoPlay(i); }
if (segState.mode[i] == FX_MODE_CUSTOM_3) {
if (strip->getSpeed(i) > SPEED_MIN) {
strip->setSpeed(i, SPEED_MIN);
}
}
}
}
@@ -786,7 +792,7 @@ void loop() {
}
}
// Async speed transition
if ((segState.mode[prevsegment] != FX_MODE_CUSTOM_0) && (fx_speed != segState.speed[prevsegment])) {
if ((segState.mode[prevsegment] != FX_MODE_CUSTOM_0) && (segState.mode[prevsegment] != FX_MODE_CUSTOM_3) && (fx_speed != segState.speed[prevsegment])) {
if (Config.transEffect) {
//if (true == false) { // disabled for the moment
if (speedFadeDelay <= millis()) {
@@ -833,7 +839,9 @@ void loop() {
// Segment change only if color and speed transitions are finished, because they are segment specific
if (prevsegment != State.segment) {
DBG_OUTPUT_PORT.println("Segment not equal");
if ((segState.mode[State.segment] == FX_MODE_CUSTOM_0) || (segState.mode[State.segment] == FX_MODE_CUSTOM_2) || (segState.mode[prevsegment] == FX_MODE_CUSTOM_0)) {
//if ((segState.mode[State.segment] == FX_MODE_CUSTOM_0) || (segState.mode[State.segment] == FX_MODE_CUSTOM_2) || (segState.mode[prevsegment] == FX_MODE_CUSTOM_0)) {
if ((segState.mode[State.segment] == FX_MODE_CUSTOM_0) || (segState.mode[prevsegment] == FX_MODE_CUSTOM_0)) {
}
fx_speed = segState.speed[State.segment];
DBG_OUTPUT_PORT.printf("Switched segment from: %i to %i", prevsegment, State.segment);
prevsegment = State.segment;
Binary file not shown.
+31 -4
View File
@@ -5,10 +5,35 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="mobile-web-app-capable" content="yes">
<link rel="shortcut icon" href="https://raw.githubusercontent.com/FabLab-Luenen/McLighting/master/Arduino/McLighting/data/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="https://raw.githubusercontent.com/FabLab-Luenen/McLighting/master/Arduino/McLighting/apple-touch-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<style>
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(/material.woff2) format('woff2');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-feature-settings: 'liga';
-webkit-font-smoothing: antialiased;
}
* {
background-repeat: no-repeat;
padding: 0;
@@ -2305,7 +2330,9 @@ function ws_connect() {
function ws_send(message) {
console.log("WS send: ", message);
data.connection.send(message);
if (message!="$") {
if ((message!="$") && (message!="~")
&& (message!="C") && (message.indexOf("Ch") == -1) && (message.indexOf("Csc") == -1) && (message.indexOf("Csp") == -1) && (message.indexOf("Csr") == -1)
&& (message.indexOf("S[") == -1) && (message.indexOf("S]") == -1)) {
data.additional_connections.forEach((conn) => {
console.log("WS send additional to: ", conn.url);
conn.send(message);
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -61,7 +61,7 @@ uint8_t prevsegment = 0;
// Change your IR Commands here. You can see them in console, after you pressed a button on the remote
uint64_t rmt_commands[BTN_CNT] = {0xF7C03F, 0xF7708F, 0xF7F00F, 0xF720DF, 0xF710EF, 0xF7A05F, 0xF7906F, 0xF7609F, 0xF750AF, 0xF7E01F, 0xF7D02F, 0xF730CF, 0xF7B04F, 0xF748B7, 0xF7C837, 0xF700FF, 0xF7807F, 0xF740BF, 0xF708F7, 0xF78877, 0xF728D7, 0xF7A857, 0xF76897, 0xF7E817, 0xFFFFFFFFFFFFFFFF};
#endif
//#define WIFIMGR_PORTAL_TIMEOUT 180
#define WIFIMGR_PORTAL_TIMEOUT 180
//#define WIFIMGR_SET_MANUAL_IP
#if defined(WIFIMGR_SET_MANUAL_IP)
-1
View File
@@ -1,5 +1,4 @@
#include <pgmspace.h>
#define edit_htm_gz_len 5563
static const char edit_htm_gz[] PROGMEM ={
0x1f, 0x8b, 0x08, 0x08, 0x79, 0x1c, 0x96, 0x5d, 0x04, 0x00, 0x65, 0x64,
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -11,7 +11,7 @@ More info on how to create custom aniamtions for WS2812FX: https://github.com/ki
uint16_t handleSegmentOFF(void) {
WS2812FX::Segment* _seg = strip->getSegment();
return _seg->speed;
return _seg->speed/(_seg->stop - _seg->start);
}
// ***************************************************************************
@@ -37,15 +37,16 @@ void handleAutoPlay(uint8_t _seg) {
}
}
uint16_t handleAuto() {
uint16_t handleAuto(void) {
WS2812FX::Segment* _seg = strip->getSegment();
return _seg->speed;
return _seg->speed/(_seg->stop - _seg->start);
}
uint16_t handleCustomWS(void) {
WS2812FX::Segment* _seg = strip->getSegment();
return _seg->speed;
return _seg->speed/(_seg->stop - _seg->start);
}
#if defined(CUSTOM_WS2812FX_ANIMATIONS)
// ***************************************************************************
// TV mode to be reviewed
@@ -76,8 +77,6 @@ uint16_t handleCustomWS(void) {
uint8_t _seg_num = strip->getSegmentIndex();
if (timeToDip[_seg_num] == false) {
if((millis() - previousMillis[_seg_num]) > interv[_seg_num]) {
DBG_OUTPUT_PORT.println("Segment:");
DBG_OUTPUT_PORT.println(_seg_num);
previousMillis[_seg_num] = millis();
//interv = random(750,4001);//Adjusts the interval for more/less frequent random light changes
interv[_seg_num] = random(800-(512 - (_seg->speed/64)),6001-(2731 - (_seg->speed/24)));
@@ -101,7 +100,6 @@ uint16_t handleCustomWS(void) {
}
}
} else {
DBG_OUTPUT_PORT.println("Dip Time");
if (millis() - dipStartTime[_seg_num] < darkTime[_seg_num]) {
for (uint16_t i=(_seg->start + 3); i<= _seg->stop; i++) {
ledstates[i] = 0;
@@ -114,10 +112,10 @@ uint16_t handleCustomWS(void) {
timeToDip[_seg_num] = false;
}
}
return _seg->speed;
return _seg->speed/(_seg->stop - _seg->start);
}
// ***************************************************************************
// TV mode
// E1.31 mode
// ***************************************************************************
uint16_t handleE131(void) {
WS2812FX::Segment* _seg = strip->getSegment();
@@ -128,7 +126,7 @@ uint16_t handleCustomWS(void) {
uint16_t universe = htons(packet.universe);
uint8_t *data = packet.property_values + 1;
if (universe < START_UNIVERSE || universe > END_UNIVERSE) return _seg->speed; //async will take care about filling the buffer
if (universe < START_UNIVERSE || universe > END_UNIVERSE) return _seg->speed/(_seg->stop - _seg->start); //async will take care about filling the buffer
// Serial.printf("Universe %u / %u Channels | Packet#: %u / Errors: %u / CH1: %u\n",
// htons(packet.universe), // The Universe for this packet
@@ -142,7 +140,7 @@ uint16_t handleCustomWS(void) {
uint16_t len = (128 + multipacketOffset > Config.stripSize) ? (Config.stripSize - multipacketOffset) : 128;
#else*/
uint16_t multipacketOffset = (universe - START_UNIVERSE) * 170; //if more than 170 LEDs * 3 colors = 510 channels, client will send in next higher universe
if (Config.stripSize <= multipacketOffset) return _seg->speed;
if (Config.stripSize <= multipacketOffset) return _seg->speed/(_seg->stop - _seg->start);
uint16_t len = (170 + multipacketOffset > Config.stripSize) ? (Config.stripSize - multipacketOffset) : 170;
/* #endif */
for (uint16_t i = 0; i < len; i++){
@@ -156,7 +154,7 @@ uint16_t handleCustomWS(void) {
}
}
}
return _seg->speed;
return _seg->speed/(_seg->stop - _seg->start);
}
/*
@@ -233,10 +231,10 @@ uint16_t handleCustomWS(void) {
}
strip->setPixelColor(pixel, color.red, color.green, color.blue, 0);
}
return _seg->speed;
return _seg->speed/(_seg->stop - _seg->start);
}
uint16_t handleGradient() {
uint16_t handleGradient(void) {
WS2812FX::Segment* _seg = strip->getSegment();
for(uint16_t j = 0; j <= (_seg->stop - _seg->start); j++) {
uint16_t pixel;
@@ -248,6 +246,6 @@ uint16_t handleCustomWS(void) {
uint32_t color = trans(_seg->colors[1], _seg->colors[0], j, (_seg->stop - _seg->start));
strip->setPixelColor(pixel, ((color >> 16) & 0xFF), ((color >> 8) & 0xFF), ((color >> 0) & 0xFF), ((color >> 24) & 0xFF));
}
return _seg->speed;
return _seg->speed/(_seg->stop - _seg->start);
}
#endif
+29
View File
@@ -28,6 +28,34 @@ server.on("/", HTTP_GET, [&](){
#endif
});
server.on("/material.woff2", HTTP_GET, [&](){
#if defined(USE_HTML_MIN_GZ)
server.send_P(200, PSTR("text/plain"), material_icons_woff2, material_icons_woff2_len);
#else
if (!handleFileRead(server.uri()))
handleNotFound();
#endif
});
server.on("/favicon.ico", HTTP_GET, [&](){
#if defined(USE_HTML_MIN_GZ)
server.sendHeader("Content-Encoding", "gzip", true);
server.send_P(200, PSTR("text/plain"), fav_icon, fav_icon_len);
#else
if (!handleFileRead(server.uri()))
handleNotFound();
#endif
});
server.on("/apple-touch-icon.png", HTTP_GET, [&](){
#if defined(USE_HTML_MIN_GZ)
server.send_P(200, PSTR("text/plain"), apple_touch_icon_png, apple_touch_icon_png_len);
#else
if (!handleFileRead(server.uri()))
handleNotFound();
#endif
});
server.on("/edit", HTTP_GET, [&](){
#if defined(USE_HTML_MIN_GZ)
server.sendHeader("Content-Encoding", "gzip", true);
@@ -78,6 +106,7 @@ server.on("/start_config_ap", []() {
server.on("/format_spiffs", []() {
DBG_OUTPUT_PORT.printf("/format_spiffs\r\n");
server.sendHeader("Access-Control-Allow-Origin", "*");
server.send(200, "text/plain", "Formatting SPIFFS ..." );
SPIFFS.format();
});
+1 -1
View File
@@ -1 +1 @@
#define SKETCH_VERSION "3.1.0.BETA3"
#define SKETCH_VERSION "3.1.0.BETA4"
+9 -1
View File
@@ -220,6 +220,14 @@
* 20 October
* Version Bump to 3.1.0.BETA3
* Bugfixes
* adresse issue: #39
* adressed issue: #39
*
* 25 October
* Version Bump to 3.1.0.BETA4
* Bugfixes
* Made GUI fully offline compatible (included material icons, etc.)
* After Timeout (#define WIFIMGR_PORTAL_TIMEOUT 180) in definitions.h Config Portal is closed and MCL is usable over own AP @192.168.4.1
* adressed issue: #48
* known problems: E1.31 is only working for one segment at the moment
*
*/
Binary file not shown.
+31 -4
View File
@@ -5,10 +5,35 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="mobile-web-app-capable" content="yes">
<link rel="shortcut icon" href="https://raw.githubusercontent.com/FabLab-Luenen/McLighting/master/Arduino/McLighting/data/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="https://raw.githubusercontent.com/FabLab-Luenen/McLighting/master/Arduino/McLighting/apple-touch-icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<style>
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(/material.woff2) format('woff2');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-feature-settings: 'liga';
-webkit-font-smoothing: antialiased;
}
* {
background-repeat: no-repeat;
padding: 0;
@@ -2305,7 +2330,9 @@ function ws_connect() {
function ws_send(message) {
console.log("WS send: ", message);
data.connection.send(message);
if (message!="$") {
if ((message!="$") && (message!="~")
&& (message!="C") && (message.indexOf("Ch") == -1) && (message.indexOf("Csc") == -1) && (message.indexOf("Csp") == -1) && (message.indexOf("Csr") == -1)
&& (message.indexOf("S[") == -1) && (message.indexOf("S]") == -1)) {
data.additional_connections.forEach((conn) => {
console.log("WS send additional to: ", conn.url);
conn.send(message);
Binary file not shown.
Binary file not shown.