Skip to content

Commit d96ca3a

Browse files
authored
Merge pull request #211 from henrygab/combined
Combined active branches
2 parents 44e1157 + 7e6e7bb commit d96ca3a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4913
-687
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ build/
44
buildcache/
55
arduino.json
66
c_cpp_properties.json
7-
.vscode
7+
.vscode
8+
9+
/platformio-override.ini
10+
/release/

esp8266-fastled-webserver/ColorWavesPlayground.h renamed to esp8266-fastled-webserver/ColorWavesPlayground.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
#include "common.h"
2+
13
// ColorWavesWithPalettes by Mark Kriegsman: https://gist.github.com/kriegsman/8281905786e8b2632aeb
24
// This function draws color waves with an ever-changing,
35
// widely-varying set of parameters, using a color palette.
46

57
// Modified by Jason Coon to replace "magic numbers" with customizable inputs via sliders in the web app.
68

7-
void colorwavesPlayground( CRGB* ledarray, uint16_t numleds, CRGBPalette16& palette)
9+
void colorwavesPlayground( CRGB* ledarray, uint16_t numleds, CRGBPalette16& palette, bool useFibonacciOrder)
810
{
911
static uint16_t sPseudotime = 0;
1012
static uint16_t sLastMillis = 0;
@@ -50,6 +52,13 @@ void colorwavesPlayground( CRGB* ledarray, uint16_t numleds, CRGBPalette16& pale
5052
CRGB newcolor = ColorFromPalette( palette, index, bri8);
5153

5254
uint16_t pixelnumber = i;
55+
56+
#if IS_FIBONACCI
57+
if (useFibonacciOrder) pixelnumber = fibonacciToPhysical[i];
58+
#else
59+
(void)useFibonacciOrder;
60+
#endif
61+
5362
pixelnumber = (numleds - 1) - pixelnumber;
5463

5564
nblend( ledarray[pixelnumber], newcolor, 128);
@@ -58,5 +67,14 @@ void colorwavesPlayground( CRGB* ledarray, uint16_t numleds, CRGBPalette16& pale
5867

5968
void colorWavesPlayground()
6069
{
61-
colorwavesPlayground(leds, NUM_LEDS, gCurrentPalette);
70+
colorwavesPlayground(leds, NUM_PIXELS, gCurrentPalette, false);
71+
}
72+
73+
74+
#if IS_FIBONACCI
75+
void colorWavesPlaygroundFibonacci()
76+
{
77+
colorwavesPlayground(leds, NUM_PIXELS, gCurrentPalette, true);
6278
}
79+
#endif
80+

esp8266-fastled-webserver/FSBrowser.h renamed to esp8266-fastled-webserver/FSBrowser.cpp

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include "common.h"
12

23
//holds the current upload
34
File fsUploadFile;
@@ -34,12 +35,15 @@ String getContentType(String filename){
3435

3536
bool handleFileRead(String path){
3637
Serial.println("handleFileRead: " + path);
37-
if(path.endsWith("/")) path += "index.htm";
38+
if (path.endsWith("/")) {
39+
path += "index.htm";
40+
}
3841
String contentType = getContentType(path);
3942
String pathWithGz = path + ".gz";
40-
if(MYFS.exists(pathWithGz) || MYFS.exists(path)){
41-
if(MYFS.exists(pathWithGz))
42-
path += ".gz";
43+
if (MYFS.exists(pathWithGz) || MYFS.exists(path)) {
44+
if (MYFS.exists(pathWithGz)) {
45+
path = pathWithGz;
46+
}
4347
File file = MYFS.open(path, "r");
4448
(void)webServer.streamFile(file, contentType);
4549
file.close();
@@ -50,68 +54,87 @@ bool handleFileRead(String path){
5054
}
5155

5256
void handleFileUpload(){
53-
if(webServer.uri() != "/edit") return;
57+
if (webServer.uri() != "/edit") return;
58+
5459
HTTPUpload& upload = webServer.upload();
55-
if(upload.status == UPLOAD_FILE_START){
60+
if (upload.status == UPLOAD_FILE_START) {
5661
String filename = upload.filename;
57-
if(!filename.startsWith("/")) filename = "/"+filename;
62+
if (!filename.startsWith("/")) {
63+
filename = "/" + filename;
64+
}
5865
Serial.print("handleFileUpload Name: "); Serial.println(filename);
5966
fsUploadFile = MYFS.open(filename, "w");
6067
filename = String();
61-
} else if(upload.status == UPLOAD_FILE_WRITE){
68+
} else if (upload.status == UPLOAD_FILE_WRITE) {
6269
//Serial.print("handleFileUpload Data: "); Serial.println(upload.currentSize);
63-
if(fsUploadFile)
70+
if (fsUploadFile) {
6471
fsUploadFile.write(upload.buf, upload.currentSize);
65-
} else if(upload.status == UPLOAD_FILE_END){
66-
if(fsUploadFile)
72+
}
73+
} else if (upload.status == UPLOAD_FILE_END) {
74+
if (fsUploadFile) {
6775
fsUploadFile.close();
76+
}
6877
Serial.print("handleFileUpload Size: "); Serial.println(upload.totalSize);
6978
}
7079
}
7180

7281
void handleFileDelete(){
73-
if(webServer.args() == 0) return webServer.send(500, "text/plain", "BAD ARGS");
82+
if (webServer.args() == 0) {
83+
return webServer.send(500, "text/plain", "BAD ARGS");
84+
}
85+
7486
String path = webServer.arg(0);
7587
Serial.println("handleFileDelete: " + path);
76-
if(path == "/")
88+
if (path == "/") {
7789
return webServer.send(500, "text/plain", "BAD PATH");
78-
if(!MYFS.exists(path))
90+
}
91+
if (!MYFS.exists(path)) {
7992
return webServer.send(404, "text/plain", "FileNotFound");
93+
}
8094
MYFS.remove(path);
8195
webServer.send(200, "text/plain", "");
8296
path = String();
8397
}
8498

8599
void handleFileCreate(){
86-
if(webServer.args() == 0)
100+
if (webServer.args() == 0) {
87101
return webServer.send(500, "text/plain", "BAD ARGS");
102+
}
88103
String path = webServer.arg(0);
89104
Serial.println("handleFileCreate: " + path);
90-
if(path == "/")
105+
if (path == "/") {
91106
return webServer.send(500, "text/plain", "BAD PATH");
92-
if(MYFS.exists(path))
107+
}
108+
if (MYFS.exists(path)) {
93109
return webServer.send(500, "text/plain", "FILE EXISTS");
110+
}
94111
File file = MYFS.open(path, "w");
95-
if(file)
112+
if (file) {
96113
file.close();
97-
else
114+
} else {
98115
return webServer.send(500, "text/plain", "CREATE FAILED");
116+
}
99117
webServer.send(200, "text/plain", "");
100118
path = String();
101119
}
102120

103121
void handleFileList() {
104-
if(!webServer.hasArg("dir")) {webServer.send(500, "text/plain", "BAD ARGS"); return;}
122+
if (!webServer.hasArg("dir")) {
123+
webServer.send(500, "text/plain", "BAD ARGS");
124+
return;
125+
}
105126

106127
String path = webServer.arg("dir");
107128
Serial.println("handleFileList: " + path);
108129
Dir dir = MYFS.openDir(path);
109130
path = String();
110131

111132
String output = "[";
112-
while(dir.next()){
133+
while (dir.next()) {
113134
File entry = dir.openFile("r");
114-
if (output != "[") output += ',';
135+
if (output != "[") {
136+
output += ',';
137+
}
115138
bool isDir = false;
116139
//bool isDir = entry.isDirectory();
117140

esp8266-fastled-webserver/Field.h

Lines changed: 0 additions & 132 deletions
This file was deleted.

0 commit comments

Comments
 (0)