spiInterface: unprotect_flash: fix return. Improve messages
This commit is contained in:
parent
d7365495aa
commit
db410839af
|
|
@ -55,11 +55,10 @@ bool SPIInterface::protect_flash(uint32_t len)
|
||||||
bool SPIInterface::unprotect_flash()
|
bool SPIInterface::unprotect_flash()
|
||||||
{
|
{
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
printInfo("unprotect_flash: ", false);
|
|
||||||
|
|
||||||
/* move device to spi access */
|
/* move device to spi access */
|
||||||
if (!prepare_flash_access()) {
|
if (!prepare_flash_access()) {
|
||||||
printError("Fail");
|
printError("SPI Flash prepare access failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -68,13 +67,14 @@ bool SPIInterface::unprotect_flash()
|
||||||
SPIFlash flash(this, false, _spif_verbose);
|
SPIFlash flash(this, false, _spif_verbose);
|
||||||
|
|
||||||
/* configure flash protection */
|
/* configure flash protection */
|
||||||
ret = flash.disable_protection() != 0;
|
printInfo("unprotect_flash: ", false);
|
||||||
|
ret = (flash.disable_protection() == 0);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
printError("Fail " + std::to_string(ret));
|
printError("Fail " + std::to_string(ret));
|
||||||
else
|
else
|
||||||
printSuccess("Done");
|
printSuccess("Done");
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
printError("Fail");
|
printError("SPI Flash access failed: ", false);
|
||||||
printError(e.what());
|
printError(e.what());
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue