Skip to content

Commit 525a9b1

Browse files
committed
Remove from favorites
1 parent 8704d4f commit 525a9b1

3 files changed

Lines changed: 29 additions & 11 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ Things that needs to be done in next updates
7979

8080

8181
## Latest Changelog
82+
* 2.6.1:
83+
* [x] Fixed T-Deck Plus touchscreen (added new env for it)
84+
* [x] Fixed M5Stack CoreS3 SD Card not mounting
85+
* [x] Add Delete from Favorites option
8286

8387
* 2.6.0:
8488
* [x] Pulling data from my new api, integrating all devices list with m5burner api and counting downloads into the m5burner database.

src/display.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,8 @@ void loopVersions(String _fid) {
10431043
}});
10441044
options.push_back({"Add to Favorite", [=] {
10451045
JsonObject fav = favorite.add<JsonObject>();
1046-
fav["name"] = String(name) + "-" + String(author);
1046+
fav["name"] = String(name) + " - " + String(author) + " (" +
1047+
String(OTA_TAG) + ")";
10471048
fav["fid"] = _fid;
10481049
fav["link"] = "";
10491050
saveConfigs();

src/onlineLauncher.cpp

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,31 @@ void ota_function() {
161161
if (returnToMenu) return;
162162
if (fav) {
163163
int idx = 0;
164-
RELOAD:
165-
options.clear();
166-
for (JsonObject item : favorite) {
167-
if (item["fid"].as<String>().length() > 0) {
168-
options.push_back({item["name"].as<String>(), [=]() {
169-
loopVersions(item["fid"].as<String>());
164+
auto NavMenu = [&](int fw) {
165+
options.clear();
166+
if (favorite[fw]["fid"].as<String>().length() > 0) {
167+
options.push_back({"View firmware", [=]() {
168+
loopVersions(favorite[fw]["fid"].as<String>());
170169
}});
171170
} else {
172-
options.push_back({item["name"].as<String>(), [=]() {
173-
installExtFirmware(item["link"].as<String>());
171+
options.push_back({"Install", [=]() {
172+
installExtFirmware(favorite[fw]["link"].as<String>());
174173
}});
175174
}
175+
options.push_back({"Remove Favorite", [=]() {
176+
favorite.remove(fw);
177+
saveConfigs();
178+
}});
179+
options.push_back({"Back to List", [=]() { /* Do nothing, just return */ }});
180+
options.push_back({"Main Menu", [=]() { returnToMenu = true; }});
181+
loopOptions(options);
182+
};
183+
RELOAD:
184+
options.clear();
185+
int count = 0;
186+
for (JsonObject item : favorite) {
187+
options.push_back({item["name"].as<String>(), [=]() { NavMenu(count); }});
188+
count++;
176189
}
177190
options.push_back({"Main Menu", [=]() { returnToMenu = true; }, ALCOLOR});
178191
idx = loopOptions(options, false, FGCOLOR, BGCOLOR, false, idx);
@@ -442,8 +455,8 @@ bool installExtFirmware(String url) {
442455
for (int i = 0x0; i <= 0x1A0; i += 0x20) { // Partition
443456
memcpy(bytes, &buff[i], 16);
444457

445-
// https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/partition-tables.html ->
446-
// spiffs (0x82) is for SPIFFS Filesystem.
458+
// https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/partition-tables.html
459+
// -> spiffs (0x82) is for SPIFFS Filesystem.
447460

448461
// if (bytes[3] == 0xFF) Serial.println(": ------- END of Table ------- |");
449462
if (bytes[3] == 0x00 || (bytes[3] >= 0x10 && bytes[3] <= 0x1F)) {

0 commit comments

Comments
 (0)