MCPcopy Create free account
hub / github.com/SmingHub/Sming / doSwitch

Function doSwitch

samples/Basic_Ota/app/application.cpp:97–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97void doSwitch()
98{
99 auto before = ota.getRunningPartition();
100 auto after = ota.getNextBootPartition();
101
102 Serial << _F("Swapping from ") << before.name() << " @ 0x" << String(before.address(), HEX) << " to "
103 << after.name() << " @ 0x" << String(after.address(), HEX) << endl;
104 if(ota.setBootPartition(after)) {
105 Serial.println(F("Restarting...\r\n"));
106 System.restart();
107 } else {
108 Serial.println(F("Switch failed."));
109 }
110}
111
112void showInfo()
113{

Callers 1

handleCommandFunction · 0.85

Calls 9

addressMethod · 0.80
printlnMethod · 0.80
StringClass · 0.50
FFunction · 0.50
getRunningPartitionMethod · 0.45
getNextBootPartitionMethod · 0.45
nameMethod · 0.45
setBootPartitionMethod · 0.45
restartMethod · 0.45

Tested by

no test coverage detected