Skip to content

Commit

Permalink
Add warning if trying to upload to stm32 in serial mode
Browse files Browse the repository at this point in the history
  • Loading branch information
noisymime committed Jun 12, 2024
1 parent 7c37e27 commit 961b16f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,18 @@ <h2><div id="detailsHeading" style="padding-left: 0.55em;" ></div></h2>
<div class="inner">
<h2>Select Serial Port</h2>
<p>Available Ports:
<select name="ports" class="select" id="portsSelect" size="10" width="20"></select>
<select name="ports" class="select" id="portsSelect" size="10" width="20" onClick="checkForValidPort()"></select>
<ul class="actions">
<!-- <li><input type='button' value="Install Serial Drivers" onclick="installDrivers();" /></li> -->
<li><input type='button' value="Refresh" onclick="refreshSerialPorts();" /></li>
<li><input type='button' value="Upload" id="btnInstall" /></li>
</ul>
<div class="features major" id="port_warning" style="display: none;">
<div id="port_warningText" style="padding-left: 0.9em; padding-right: 0.9em; overflow-y: scroll; height: 10vh;"></div>
</div>
</p>
</div>


<div id="serialDetectError"></div>
</section>
Expand Down
27 changes: 27 additions & 0 deletions renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,33 @@ function refreshSerialPorts()
})
}

//Checks whether the port currently selected is a known invalid one or not
function checkForValidPort()
{
var validPort = true;
var errorText = ""
var option = document.getElementById('portsSelect').options[document.getElementById('portsSelect').selectedIndex];

if(option.getAttribute('board') == "STM32F407_serial")
{
validPort = false;
errorText = "Serial mode is not supported on STM32F407 boards. Please place the board into DFU mode instead.";
}

if(validPort)
{
document.getElementById('port_warning').style.display = "none";
document.getElementById('port_warningText').innerHTML = "";
document.getElementById('btnInstall').disabled = false;
}
else
{
document.getElementById('port_warning').style.display = "block";
document.getElementById('port_warningText').innerHTML = errorText;
document.getElementById('btnInstall').disabled = true;
}
}

function refreshDetails()
{
var selectElement = document.getElementById('versionsSelect');
Expand Down

0 comments on commit 961b16f

Please sign in to comment.