MCPcopy Create free account
hub / github.com/BruceDevices/firmware / selectMenuOption

Function selectMenuOption

src/modules/others/ibutton.cpp:309–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307}
308
309static void selectMenuOption() {
310 options = {};
311
312 if (keyLoaded) {
313 options.emplace_back("Write to key", []() { setAction(ACTION_WRITE); });
314 options.emplace_back("Save to file", []() { setAction(ACTION_SAVE); });
315 }
316
317 options.emplace_back("Load from file", []() { setAction(ACTION_LOAD); });
318
319 if (keyLoaded) {
320 options.emplace_back("Reset buffer", []() { setAction(ACTION_RESET); });
321 }
322
323 options.emplace_back("Setup pin", []() { setAction(ACTION_SETUP_PIN); });
324 options.emplace_back("Close menu", []() { setAction(ACTION_CLOSE); });
325 options.emplace_back("Main menu", []() { setAction(ACTION_MAIN_MENU); });
326
327 selectedAction = ACTION_CLOSE;
328 loopOptions(options);
329 options.clear();
330
331 switch (selectedAction) {
332 case ACTION_WRITE: doWrite(); break;
333 case ACTION_SAVE: doSave(); break;
334 case ACTION_LOAD: doLoad(); break;
335 case ACTION_RESET: doReset(); break;
336 case ACTION_SETUP_PIN: restartNeeded = true; return;
337 case ACTION_MAIN_MENU: returnFromMenu = true; return;
338 case ACTION_CLOSE: break;
339 }
340}
341
342// ---------------------------------------------------------------------------
343// Public entry point

Callers 1

setup_ibuttonFunction · 0.85

Calls 7

setActionFunction · 0.85
doWriteFunction · 0.85
doSaveFunction · 0.85
doLoadFunction · 0.85
doResetFunction · 0.85
loopOptionsFunction · 0.50
clearMethod · 0.45

Tested by

no test coverage detected