Skip to content

Commit eebc1e2

Browse files
authored
Merge pull request #764 from LeeLeahy2/display-partitions
Add 's' to system menu to display the partition table
2 parents 4ce4676 + 3f6f545 commit eebc1e2

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

Firmware/RTK_Surveyor/RTK_Surveyor.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,13 @@ void setup()
896896
DMW_c("beginDisplay");
897897
beginDisplay(); // Start display to be able to display any errors
898898

899+
DMW_c("findSpiffsPartition");
900+
if (!findSpiffsPartition())
901+
{
902+
printPartitionTable(); // Print the partition tables
903+
reportFatalError("spiffs partition not found!");
904+
}
905+
899906
DMW_c("beginFS");
900907
beginFS(); // Start LittleFS file system for settings
901908

Firmware/RTK_Surveyor/menuSystem.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,8 @@ void menuDebugSoftware()
647647
systemPrintf("%d (%d days %d:%02d:%02d)\r\n", settings.rebootSeconds, days, hours, minutes, seconds);
648648
}
649649

650+
systemPrintf("34) Print partition table\r\n");
651+
650652
// Tasks
651653
systemPrint("50) Task Highwater Reporting: ");
652654
if (settings.enableTaskReports == true)
@@ -716,6 +718,8 @@ void menuDebugSoftware()
716718
}
717719
}
718720
}
721+
else if (incoming == 34)
722+
printPartitionTable();
719723
else if (incoming == 50)
720724
settings.enableTaskReports ^= 1;
721725
else if (incoming == 60)

Firmware/RTK_Surveyor/support.ino

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,41 @@ void printUbloxInvalidData(PARSE_STATE *parse)
799799
systemPrintf(" %s Invalid UBX data, %d bytes\r\n", parse->parserName, parse->length - 1);
800800
}
801801

802+
void printPartitionTable(void)
803+
{
804+
systemPrintln("ESP32 Partition table:\n");
805+
806+
systemPrintln("| Type | Sub | Offset | Size | Label |");
807+
systemPrintln("| ---- | --- | -------- | -------- | ---------------- |");
808+
809+
esp_partition_iterator_t pi = esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, NULL);
810+
if (pi != NULL)
811+
{
812+
do
813+
{
814+
const esp_partition_t *p = esp_partition_get(pi);
815+
systemPrintf("| %02x | %02x | 0x%06X | 0x%06X | %-16s |\r\n", p->type, p->subtype, p->address, p->size,
816+
p->label);
817+
} while ((pi = (esp_partition_next(pi))));
818+
}
819+
}
820+
821+
// Locate the partition for the little file system
822+
bool findSpiffsPartition(void)
823+
{
824+
esp_partition_iterator_t pi = esp_partition_find(ESP_PARTITION_TYPE_ANY, ESP_PARTITION_SUBTYPE_ANY, NULL);
825+
if (pi != NULL)
826+
{
827+
do
828+
{
829+
const esp_partition_t *p = esp_partition_get(pi);
830+
if (strcmp(p->label, "spiffs") == 0)
831+
return true;
832+
} while ((pi = (esp_partition_next(pi))));
833+
}
834+
return false;
835+
}
836+
802837
// Verify table sizes match enum definitions
803838
void verifyTables()
804839
{

0 commit comments

Comments
 (0)