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

Function addToRecentCodes

src/modules/ir/custom_ir.cpp:28–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26static std::vector<IRCode *> recent_ircodes;
27
28void addToRecentCodes(IRCode *ircode) {
29 // copy ircode -> recent_ircodes
30 // if code exist in recent codes do not save it
31 for (auto recent_ircode : recent_ircodes) {
32 if (recent_ircode->filepath == ircode->filepath) { return; }
33 }
34
35 IRCode *ircode_copy = new IRCode(ircode);
36 recent_ircodes.insert(recent_ircodes.begin(), ircode_copy);
37
38 if (recent_ircodes.size() > 16) { // cycle
39 delete recent_ircodes.back();
40 recent_ircodes.pop_back();
41 }
42}
43
44void selectRecentIrMenu() {
45 // show menu with filenames

Callers 1

chooseCmdIrFileFunction · 0.70

Calls 2

sizeMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected