Skip to content

Combined active branches #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Nov 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ build/
buildcache/
arduino.json
c_cpp_properties.json
.vscode
.vscode

/platformio-override.ini
/release/
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include "common.h"

// ColorWavesWithPalettes by Mark Kriegsman: https://gist.github.com/kriegsman/8281905786e8b2632aeb
// This function draws color waves with an ever-changing,
// widely-varying set of parameters, using a color palette.

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

void colorwavesPlayground( CRGB* ledarray, uint16_t numleds, CRGBPalette16& palette)
void colorwavesPlayground( CRGB* ledarray, uint16_t numleds, CRGBPalette16& palette, bool useFibonacciOrder)
{
static uint16_t sPseudotime = 0;
static uint16_t sLastMillis = 0;
Expand Down Expand Up @@ -50,6 +52,13 @@ void colorwavesPlayground( CRGB* ledarray, uint16_t numleds, CRGBPalette16& pale
CRGB newcolor = ColorFromPalette( palette, index, bri8);

uint16_t pixelnumber = i;

#if IS_FIBONACCI
if (useFibonacciOrder) pixelnumber = fibonacciToPhysical[i];
#else
(void)useFibonacciOrder;
#endif

pixelnumber = (numleds - 1) - pixelnumber;

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

void colorWavesPlayground()
{
colorwavesPlayground(leds, NUM_LEDS, gCurrentPalette);
colorwavesPlayground(leds, NUM_PIXELS, gCurrentPalette, false);
}


#if IS_FIBONACCI
void colorWavesPlaygroundFibonacci()
{
colorwavesPlayground(leds, NUM_PIXELS, gCurrentPalette, true);
}
#endif

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "common.h"

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

bool handleFileRead(String path){
Serial.println("handleFileRead: " + path);
if(path.endsWith("/")) path += "index.htm";
if (path.endsWith("/")) {
path += "index.htm";
}
String contentType = getContentType(path);
String pathWithGz = path + ".gz";
if(MYFS.exists(pathWithGz) || MYFS.exists(path)){
if(MYFS.exists(pathWithGz))
path += ".gz";
if (MYFS.exists(pathWithGz) || MYFS.exists(path)) {
if (MYFS.exists(pathWithGz)) {
path = pathWithGz;
}
File file = MYFS.open(path, "r");
(void)webServer.streamFile(file, contentType);
file.close();
Expand All @@ -50,68 +54,87 @@ bool handleFileRead(String path){
}

void handleFileUpload(){
if(webServer.uri() != "/edit") return;
if (webServer.uri() != "/edit") return;

HTTPUpload& upload = webServer.upload();
if(upload.status == UPLOAD_FILE_START){
if (upload.status == UPLOAD_FILE_START) {
String filename = upload.filename;
if(!filename.startsWith("/")) filename = "/"+filename;
if (!filename.startsWith("/")) {
filename = "/" + filename;
}
Serial.print("handleFileUpload Name: "); Serial.println(filename);
fsUploadFile = MYFS.open(filename, "w");
filename = String();
} else if(upload.status == UPLOAD_FILE_WRITE){
} else if (upload.status == UPLOAD_FILE_WRITE) {
//Serial.print("handleFileUpload Data: "); Serial.println(upload.currentSize);
if(fsUploadFile)
if (fsUploadFile) {
fsUploadFile.write(upload.buf, upload.currentSize);
} else if(upload.status == UPLOAD_FILE_END){
if(fsUploadFile)
}
} else if (upload.status == UPLOAD_FILE_END) {
if (fsUploadFile) {
fsUploadFile.close();
}
Serial.print("handleFileUpload Size: "); Serial.println(upload.totalSize);
}
}

void handleFileDelete(){
if(webServer.args() == 0) return webServer.send(500, "text/plain", "BAD ARGS");
if (webServer.args() == 0) {
return webServer.send(500, "text/plain", "BAD ARGS");
}

String path = webServer.arg(0);
Serial.println("handleFileDelete: " + path);
if(path == "/")
if (path == "/") {
return webServer.send(500, "text/plain", "BAD PATH");
if(!MYFS.exists(path))
}
if (!MYFS.exists(path)) {
return webServer.send(404, "text/plain", "FileNotFound");
}
MYFS.remove(path);
webServer.send(200, "text/plain", "");
path = String();
}

void handleFileCreate(){
if(webServer.args() == 0)
if (webServer.args() == 0) {
return webServer.send(500, "text/plain", "BAD ARGS");
}
String path = webServer.arg(0);
Serial.println("handleFileCreate: " + path);
if(path == "/")
if (path == "/") {
return webServer.send(500, "text/plain", "BAD PATH");
if(MYFS.exists(path))
}
if (MYFS.exists(path)) {
return webServer.send(500, "text/plain", "FILE EXISTS");
}
File file = MYFS.open(path, "w");
if(file)
if (file) {
file.close();
else
} else {
return webServer.send(500, "text/plain", "CREATE FAILED");
}
webServer.send(200, "text/plain", "");
path = String();
}

void handleFileList() {
if(!webServer.hasArg("dir")) {webServer.send(500, "text/plain", "BAD ARGS"); return;}
if (!webServer.hasArg("dir")) {
webServer.send(500, "text/plain", "BAD ARGS");
return;
}

String path = webServer.arg("dir");
Serial.println("handleFileList: " + path);
Dir dir = MYFS.openDir(path);
path = String();

String output = "[";
while(dir.next()){
while (dir.next()) {
File entry = dir.openFile("r");
if (output != "[") output += ',';
if (output != "[") {
output += ',';
}
bool isDir = false;
//bool isDir = entry.isDirectory();

Expand Down
132 changes: 0 additions & 132 deletions esp8266-fastled-webserver/Field.h

This file was deleted.

Loading