Skip to content

Commit

Permalink
Bugfix for #66
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Knoop committed Nov 4, 2020
1 parent aa548dd commit 23c243a
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 11 deletions.
Binary file modified SOURCES/WEBAPP/ESP32/aurora/aurora.ino.esp32.bin
Binary file not shown.
Binary file modified SOURCES/WEBAPP/ESP32/aurora/data/aurora.jgz
Binary file not shown.
2 changes: 1 addition & 1 deletion SOURCES/WEBAPP/ESP32/aurora/data/dsp.html
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
</td></tr>
<tr><td>Impulse Response:</td></tr>
<tr><td><input type="file" id="irfile" width="95%"></td></tr>
<tr><td colspan="2"><button class="send" id="fir_bypass" onclick="bypass('fir_bypass');sendParam('fir');" data-bypass="0">Bypass</button></td></tr>
<tr><td colspan="2"><button class="send" id="fir_bypass" onclick="bypass('fir_bypass');sendParam('firbypass');" data-bypass="0">Bypass</button></td></tr>
<tr><td colspan="2"><button class="send" onclick="sendParam('fir')">Send</button></td></tr>
</table>
</div>
Expand Down
25 changes: 17 additions & 8 deletions SOURCES/WEBAPP/ESP32/aurora/web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1202,19 +1202,15 @@ void handlePostXoJson( AsyncWebServerRequest* request, uint8_t* data )
/*! Handles the POST request for a FIR impulse response
*
*/
void handlePostFirJson( AsyncWebServerRequest* request, uint8_t* data )
void handlePostFirBypassJson( AsyncWebServerRequest* request, uint8_t* data )
{
Serial.println( "POST /fir" );
//Serial.println( "Body:");
//for(size_t i=0; i<len; i++)
// Serial.write(data[i]);
//Serial.println();
Serial.println( "POST /firbypass" );

DynamicJsonDocument jsonDoc(1024);
DeserializationError err = deserializeJson( jsonDoc, (const char*)data );
if( err )
{
Serial.print( "[ERROR] handlePostFirJson(): Deserialization failed. " );
Serial.print( "[ERROR] handlePostFirBypassJson(): Deserialization failed. " );
Serial.println( err.c_str() );
request->send( 400, "text/plain", err.c_str() );
return;
Expand All @@ -1226,6 +1222,13 @@ void handlePostFirJson( AsyncWebServerRequest* request, uint8_t* data )
Serial.println( root["idx"].as<String>() );

uint32_t idx = static_cast<uint32_t>(root["idx"].as<String>().toInt());
if( root["bypass"].as<String>().toInt() == 0 )
paramFir[idx].bypass = false;
else
paramFir[idx].bypass = true;

if(paramFir[idx].bypass)
Serial.println("Bypass");

setFir( idx );

Expand Down Expand Up @@ -1748,7 +1751,7 @@ void handleFileUpload( AsyncWebServerRequest* request, uint8_t* data, size_t len
*/
void handleIrUpload( AsyncWebServerRequest* request, uint8_t* data, size_t len, size_t index, size_t total )
{
if (!index)
if(!index)
{
Serial.println("POST /fir");
if( request->hasParam( "idx" ) )
Expand All @@ -1769,7 +1772,9 @@ void handleIrUpload( AsyncWebServerRequest* request, uint8_t* data, size_t len,
if( len > 0 )
{
for( int kk = 0; kk < len; kk++ )
{
((uint8_t*)(paramFir[currentFirUploadIdx].ir))[index + kk] = data[kk];
}
}

if( index + len >= total )
Expand Down Expand Up @@ -1916,6 +1921,10 @@ void setupWebserver (void)
{
handlePostSpdifOutJson( request, data );
});
server.on( "/firbypass", HTTP_POST, [](AsyncWebServerRequest *request){}, NULL, [](AsyncWebServerRequest* request, uint8_t* data, size_t len, size_t index, size_t total )
{
handlePostFirBypassJson( request, data );
});

//--- webOTA stuff ---
server.on( "/webota", HTTP_GET, [](AsyncWebServerRequest *request ) { request->send( 200, "text/html", webota_html ); });
Expand Down
Binary file modified SOURCES/WEBAPP/js/aurora.jgz
Binary file not shown.
14 changes: 13 additions & 1 deletion SOURCES/WEBAPP/js/aurora.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,11 +641,23 @@ function postJson(btp){
var fir = new Blob([taps], {type:'application/octet-binary'});
return fetch("/fir?idx="+idx+"&bypass="+bypass,{method:'POST',headers:{},body:fir});
}).then(function(response){
document.getElementById("wait").style.display = "none";
document.getElementById("plzw").style.display = "none";
resolve(response);
});
}
}
else if(btp=="firbypass"){
document.getElementById("plzw").style.display="block";
data.idx=document.getElementById("fir").dataset.idx;
data.bypass=document.getElementById("fir_bypass").dataset.bypass;

return fetch("/firbypass",{method:"POST",headers:{
"Content-Type": "application/json"},
body:JSON.stringify(data)
}).then(function(response){
document.getElementById("plzw").style.display = "none";
});
}
}

function openPlugin(){document.getElementById("plugin").style.display = "block";}
Expand Down
Binary file modified SOURCES/WEBAPP/plugins/4FIRs/aurora.jgz
Binary file not shown.
2 changes: 1 addition & 1 deletion SOURCES/WEBAPP/plugins/4FIRs/dsp.html
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@
</td></tr>
<tr><td>Impulse Response:</td></tr>
<tr><td><input type="file" id="irfile" width="95%"></td></tr>
<tr><td colspan="2"><button class="send" id="fir_bypass" onclick="bypass('fir_bypass');sendParam('fir');" data-bypass="0">Bypass</button></td></tr>
<tr><td colspan="2"><button class="send" id="fir_bypass" onclick="bypass('fir_bypass');sendParam('firbypass');" data-bypass="0">Bypass</button></td></tr>
<tr><td colspan="2"><button class="send" onclick="sendParam('fir')">Send</button></td></tr>
</table>
</div>
Expand Down
Binary file modified SOURCES/WEBAPP/plugins/8channels/aurora.jgz
Binary file not shown.
Binary file modified SOURCES/WEBAPP/plugins/homecinema71/aurora.jgz
Binary file not shown.

0 comments on commit 23c243a

Please sign in to comment.