Skip to content

Commit

Permalink
fixed baking crash firmware, added 2 generic blocks, fixed blendmodes
Browse files Browse the repository at this point in the history
  • Loading branch information
benkuper committed Jul 18, 2019
1 parent d00ecea commit bc15d37
Show file tree
Hide file tree
Showing 23 changed files with 399 additions and 102 deletions.
2 changes: 2 additions & 0 deletions BenTo.jucer
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
<FILE id="WOljwS" name="strobe.png" compile="0" resource="1" file="Resources/models/patterns/strobe.png"/>
</GROUP>
<FILE id="S1AUx7" name="dmx.png" compile="0" resource="1" file="Resources/models/dmx.png"/>
<FILE id="qD4otD" name="multipoint.png" compile="0" resource="1" file="Resources/models/multipoint.png"/>
<FILE id="OO6Nta" name="node.png" compile="0" resource="1" file="Resources/models/node.png"/>
<FILE id="MQHQlQ" name="picture.png" compile="0" resource="1" file="Resources/models/picture.png"/>
<FILE id="BZoVed" name="point.png" compile="0" resource="1" file="Resources/models/point.png"/>
<FILE id="a1DDEw" name="script.png" compile="0" resource="1" file="Resources/models/script.png"/>
<FILE id="Rlqbru" name="timeline.png" compile="0" resource="1" file="Resources/models/timeline.png"/>
<FILE id="ZghcER" name="video.png" compile="0" resource="1" file="Resources/models/video.png"/>
Expand Down
16 changes: 16 additions & 0 deletions Builds/MacOSX/BenTo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,13 @@
isa = PBXBuildFile;
fileRef = B3F00A16D10651397C0D1BAE;
};
003661861512974059D9E83E = {
isa = PBXFileReference;
lastKnownFileType = image.png;
name = multipoint.png;
path = ../../Resources/models/multipoint.png;
sourceTree = "SOURCE_ROOT";
};
014A84A6934D87C73CBD3B5C = {
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
Expand Down Expand Up @@ -874,6 +881,13 @@
path = ../../Source/LightBlock/model/blocks/timeline/TimelineBlock.h;
sourceTree = "SOURCE_ROOT";
};
2802E348ED9155CFCD865E76 = {
isa = PBXFileReference;
lastKnownFileType = image.png;
name = point.png;
path = ../../Resources/models/point.png;
sourceTree = "SOURCE_ROOT";
};
2863F55FB1348E82DB781B00 = {
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
Expand Down Expand Up @@ -2563,8 +2577,10 @@
children = (
208154AD871CA4748CAF4FD4,
7ADE26AC714AABF818B8BECE,
003661861512974059D9E83E,
42D0B60221EE6B79C91E4545,
E7B7F5671349BE13E13B25AF,
2802E348ED9155CFCD865E76,
484A93983DFB463CB048F899,
5617809C4A723B606C5B0812,
D2D2C8114E3834E55E3E0403,
Expand Down
16 changes: 16 additions & 0 deletions Builds/MacOSX_CI/BenTo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,13 @@
isa = PBXBuildFile;
fileRef = B3F00A16D10651397C0D1BAE;
};
003661861512974059D9E83E = {
isa = PBXFileReference;
lastKnownFileType = image.png;
name = multipoint.png;
path = ../../Resources/models/multipoint.png;
sourceTree = "SOURCE_ROOT";
};
014A84A6934D87C73CBD3B5C = {
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
Expand Down Expand Up @@ -874,6 +881,13 @@
path = ../../Source/LightBlock/model/blocks/timeline/TimelineBlock.h;
sourceTree = "SOURCE_ROOT";
};
2802E348ED9155CFCD865E76 = {
isa = PBXFileReference;
lastKnownFileType = image.png;
name = point.png;
path = ../../Resources/models/point.png;
sourceTree = "SOURCE_ROOT";
};
2863F55FB1348E82DB781B00 = {
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
Expand Down Expand Up @@ -2563,8 +2577,10 @@
children = (
208154AD871CA4748CAF4FD4,
7ADE26AC714AABF818B8BECE,
003661861512974059D9E83E,
42D0B60221EE6B79C91E4545,
E7B7F5671349BE13E13B25AF,
2802E348ED9155CFCD865E76,
484A93983DFB463CB048F899,
5617809C4A723B606C5B0812,
D2D2C8114E3834E55E3E0403,
Expand Down
2 changes: 2 additions & 0 deletions Builds/VS2017_CI/BenTo_App.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3610,8 +3610,10 @@
<None Include="..\..\Resources\models\patterns\solidColor.png"/>
<None Include="..\..\Resources\models\patterns\strobe.png"/>
<None Include="..\..\Resources\models\dmx.png"/>
<None Include="..\..\Resources\models\multipoint.png"/>
<None Include="..\..\Resources\models\node.png"/>
<None Include="..\..\Resources\models\picture.png"/>
<None Include="..\..\Resources\models\point.png"/>
<None Include="..\..\Resources\models\script.png"/>
<None Include="..\..\Resources\models\timeline.png"/>
<None Include="..\..\Resources\models\video.png"/>
Expand Down
6 changes: 6 additions & 0 deletions Builds/VS2017_CI/BenTo_App.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -6788,12 +6788,18 @@
<None Include="..\..\Resources\models\dmx.png">
<Filter>BenTo\Resources\models</Filter>
</None>
<None Include="..\..\Resources\models\multipoint.png">
<Filter>BenTo\Resources\models</Filter>
</None>
<None Include="..\..\Resources\models\node.png">
<Filter>BenTo\Resources\models</Filter>
</None>
<None Include="..\..\Resources\models\picture.png">
<Filter>BenTo\Resources\models</Filter>
</None>
<None Include="..\..\Resources\models\point.png">
<Filter>BenTo\Resources\models</Filter>
</None>
<None Include="..\..\Resources\models\script.png">
<Filter>BenTo\Resources\models</Filter>
</None>
Expand Down
26 changes: 23 additions & 3 deletions Firmware/BentoFlowCreator/BWebServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class BentoWebServer
static File uploadingFile;
static WebServer server;
static int uploadedBytes;

static bool isUploading;

BentoWebServer()
{
instance = this;
Expand All @@ -41,6 +44,8 @@ class BentoWebServer
addUploadStartCallback(&BentoWebServer::onUploadDefaultCallback);
addUploadProgressCallback(&BentoWebServer::onUploadProgressDefaultCallback);
addUploadFinishCallback(&BentoWebServer::onUploadDefaultCallback);

isUploading = false;
}

void update()
Expand All @@ -59,6 +64,8 @@ class BentoWebServer
if (upload.status == UPLOAD_FILE_START)
{
uploadedBytes = 0;
//totalBytes = server.header("Content-Length").toInt();

uploadingFile = FileManager::openFile(upload.filename, true, true);
if(uploadingFile)
{
Expand All @@ -67,6 +74,9 @@ class BentoWebServer
{
DBG("ERROR WHEN CREATING THE FILE");
}

isUploading = true;

}
else if (upload.status == UPLOAD_FILE_WRITE)
{
Expand All @@ -78,12 +88,13 @@ class BentoWebServer
}else
{
uploadingFile.write(upload.buf, upload.currentSize);
DBG("New file size : "+String(uploadingFile.size()));
}

uploadedBytes += upload.currentSize;

DBG("Uploaded "+String(uploadedBytes));
float p = uploadedBytes*1.0f/1000000;
instance->onUploadProgressEvent(p);
if(uploadedBytes % 4000 < 2000) instance->onUploadProgressEvent(p);
}
}
else if (upload.status == UPLOAD_FILE_END)
Expand All @@ -95,24 +106,31 @@ class BentoWebServer
DBG("Upload total size "+String(upload.totalSize)+" < > "+String(uploadingFile.size()));
uploadingFile.close();
instance->onUploadFinishEvent(n);
isUploading = false;
}else
{
DBG("Upload finish ERROR");
isUploading = false;
}

}else if(upload.status == UPLOAD_FILE_ABORTED)
{
DBG("ABOORT !!!!!!!!!!");
isUploading = false;
}

}

static void returnOK() {
server.send(200, "text/plain", "ok");
}

static void returnFail(String msg) {
DBG("Failed here");
server.send(500, "text/plain", msg + "\r\n");
}

static void handleNotFound() {
DBG("Not found here");
server.send(404, "text/plain", "[notfound]");
}

Expand All @@ -138,4 +156,6 @@ BentoWebServer * BentoWebServer::instance = NULL;
WebServer BentoWebServer::server(80);
File BentoWebServer::uploadingFile;
int BentoWebServer::uploadedBytes = 0;
bool BentoWebServer::isUploading = false;
//static BentoWebServer::totalBytes = 1000000;
#endif
24 changes: 14 additions & 10 deletions Firmware/BentoFlowCreator/BentoFlowCreator.ino
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ long lastOrientationSendTime = 0;
#if USE_BUTTON
void onButtonEvent(int type)
{
Serial.print("Button Event : ");
Serial.println(type);
DBG("Button Event : "+String(type));

switch (type)
{
Expand Down Expand Up @@ -396,9 +395,11 @@ void uploadStarted(const String &fileName)
void uploadProgress(float progress)
{
DBG("Upload progress " + String(progress));
int index = ((int)(progress * NUM_LEDS)) % NUM_LEDS;
if (index > 0) setRange(0, index, CRGB(255, 0, 255), true);
setLed(index, CRGB(255, 255, 255));
float fIndex = fmodf(progress * NUM_LEDS, NUM_LEDS);
int index = floor(fIndex);
if (index > 0) setRange(0, index, CHSV(30+progress*40, 255, 255));
int rest = (fmodf(fIndex,1)-.5f*2)*255;
setLed(index, CHSV(30+progress*40,std::max(rest,0), std::min(rest,0)+255));
}

void uploadFinished(const String &fileName)
Expand Down Expand Up @@ -534,11 +535,19 @@ void setup()
setFullColor(CRGB::Black);
#endif

Serial.setDebugOutput(true);
DBG("Bento is READY :)");
}

void loop()
{
processSerial();

#if USE_SERVER
webServer.update();
if(BentoWebServer::isUploading) return;
#endif


#if USE_BUTTON
btManager.update();
Expand All @@ -550,10 +559,6 @@ void loop()
oscManager.update();
#endif

#if USE_SERVER
webServer.update();
#endif

#endif //WIFI

#if USE_TOUCH
Expand All @@ -572,7 +577,6 @@ void loop()
batteryManager.update();
#endif

processSerial();
}

void processSerial()
Expand Down
Loading

0 comments on commit bc15d37

Please sign in to comment.