Skip to content

Add 's' to system menu to display the partition table #764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Firmware/RTK_Surveyor/RTK_Surveyor.ino
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,13 @@ void setup()
DMW_c("beginDisplay");
beginDisplay(); // Start display to be able to display any errors

DMW_c("findSpiffsPartition");
if (!findSpiffsPartition())
{
printPartitionTable(); // Print the partition tables
reportFatalError("spiffs partition not found!");
}

DMW_c("beginFS");
beginFS(); // Start LittleFS file system for settings

Expand Down
4 changes: 4 additions & 0 deletions Firmware/RTK_Surveyor/menuSystem.ino
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,8 @@ void menuDebugSoftware()
systemPrintf("%d (%d days %d:%02d:%02d)\r\n", settings.rebootSeconds, days, hours, minutes, seconds);
}

systemPrintf("34) Print partition table\r\n");

// Tasks
systemPrint("50) Task Highwater Reporting: ");
if (settings.enableTaskReports == true)
Expand Down Expand Up @@ -716,6 +718,8 @@ void menuDebugSoftware()
}
}
}
else if (incoming == 34)
printPartitionTable();
else if (incoming == 50)
settings.enableTaskReports ^= 1;
else if (incoming == 60)
Expand Down
35 changes: 35 additions & 0 deletions Firmware/RTK_Surveyor/support.ino
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,41 @@ void printUbloxInvalidData(PARSE_STATE *parse)
systemPrintf(" %s Invalid UBX data, %d bytes\r\n", parse->parserName, parse->length - 1);
}

void printPartitionTable(void)
{
systemPrintln("ESP32 Partition table:\n");

systemPrintln("| Type | Sub | Offset | Size | Label |");
systemPrintln("| ---- | --- | -------- | -------- | ---------------- |");

esp_partition_iterator_t pi = esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, NULL);
if (pi != NULL)
{
do
{
const esp_partition_t *p = esp_partition_get(pi);
systemPrintf("| %02x | %02x | 0x%06X | 0x%06X | %-16s |\r\n", p->type, p->subtype, p->address, p->size,
p->label);
} while ((pi = (esp_partition_next(pi))));
}
}

// Locate the partition for the little file system
bool findSpiffsPartition(void)
{
esp_partition_iterator_t pi = esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, NULL);
if (pi != NULL)
{
do
{
const esp_partition_t *p = esp_partition_get(pi);
if (strcmp(p->label, "spiffs") == 0)
return true;
} while ((pi = (esp_partition_next(pi))));
}
return false;
}

// Verify table sizes match enum definitions
void verifyTables()
{
Expand Down