Add warning if trying to upload to stm32 in serial mode

This commit is contained in:
Josh Stewart 2024-06-12 13:40:30 +10:00
parent 7c37e2790b
commit 961b16f8d8
2 changed files with 32 additions and 1 deletions

View File

@ -80,14 +80,18 @@
<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>

View File

@ -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');