Skip to content

Commit 06b02fe

Browse files
committed
Add menuLogSelection - interim solution for Facet Flex mosaic-X5
TODO: rework settings.enableLogging to properly support the Facet Flex mosaic-X5. It needs its a separate enable for internal NMEA logging. But that means reworking everything...
1 parent 62fe870 commit 06b02fe

File tree

3 files changed

+106
-66
lines changed

3 files changed

+106
-66
lines changed

Firmware/RTK_Everywhere/GNSS_Mosaic.ino

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,11 @@ GNSS_Mosaic.ino
2626
// File type "1" is NMEA
2727
//==============================================================================
2828

29-
//----------------------------------------
30-
// Control the messages that get logged to SD
31-
//----------------------------------------
32-
void menuLogMosaic()
29+
void printMosaicCardSpace()
3330
{
34-
if (!present.mosaicMicroSd) // This may be needed for the G5 P3 ?
35-
return;
36-
37-
bool applyChanges = false;
38-
39-
while (1)
31+
// mosaicSdCardSize and mosaicSdFreeSpace are updated via the SBF 4059 (storeBlock4059)
32+
if (present.mosaicMicroSd)
4033
{
41-
systemPrintln();
42-
systemPrintln("Menu: Logging");
43-
systemPrintln();
44-
4534
char sdCardSizeChar[20];
4635
String cardSize;
4736
stringHumanReadableSize(cardSize, mosaicSdCardSize);
@@ -54,31 +43,29 @@ void menuLogMosaic()
5443
// On Facet mosaic, the SD is connected directly to the X5 and is accessible
5544
// On Facet Flex X5, the internal mosaic SD card is not accessible
5645
char myString[70];
57-
snprintf(myString, sizeof(myString), "Mosaic SD card size: %s / Free space: %s", sdCardSizeChar, sdFreeSpaceChar);
46+
snprintf(myString, sizeof(myString), "SD card size: %s / Free space: %s", sdCardSizeChar, sdFreeSpaceChar);
5847
systemPrintln(myString);
48+
}
49+
}
50+
51+
//----------------------------------------
52+
// Control the messages that get logged to SD
53+
//----------------------------------------
54+
void menuLogMosaic()
55+
{
56+
if (!present.mosaicMicroSd) // This may be needed for the G5 P3 ?
57+
return;
58+
59+
bool applyChanges = false;
60+
61+
while (1)
62+
{
63+
systemPrintln();
64+
systemPrintln("Menu: Mosaic Logging");
5965
systemPrintln();
6066

61-
if (settings.enableSD && online.microSD)
62-
{
63-
char sdCardSizeChar[20];
64-
String cardSize;
65-
stringHumanReadableSize(cardSize, sdCardSize);
66-
cardSize.toCharArray(sdCardSizeChar, sizeof(sdCardSizeChar));
67-
char sdFreeSpaceChar[20];
68-
String freeSpace;
69-
stringHumanReadableSize(freeSpace, sdFreeSpace);
70-
freeSpace.toCharArray(sdFreeSpaceChar, sizeof(sdFreeSpaceChar));
71-
72-
char myString[70];
73-
snprintf(myString, sizeof(myString), "Accessible SD card size: %s / Free space: %s", sdCardSizeChar, sdFreeSpaceChar);
74-
systemPrintln(myString);
75-
76-
if (online.logging)
77-
{
78-
systemPrintf("Accessible SD current log file name: %s\r\n", logFileName);
79-
}
80-
systemPrintln();
81-
}
67+
printMosaicCardSpace();
68+
systemPrintln();
8269

8370
systemPrint("1) Log NMEA to microSD: ");
8471
if (settings.enableLogging == true)

Firmware/RTK_Everywhere/menuMain.ino

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,8 @@ void menuMain()
234234
menuBase();
235235
else if (incoming == 4)
236236
menuPorts();
237-
#ifdef COMPILE_MOSAICX5
238-
else if (incoming == 5 && present.gnss_mosaicX5)
239-
menuLogMosaic();
240-
#endif // COMPILE_MOSAICX5
241237
else if (incoming == 5 && productVariant != RTK_TORCH) // Torch does not have logging
242-
menuLog();
238+
menuLogSelection();
243239
else if (incoming == 6)
244240
menuWiFi();
245241
else if (incoming == 7)

Firmware/RTK_Everywhere/menuMessages.ino

Lines changed: 82 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,82 @@
1+
// Menu of Logging Menus
2+
void menuLogSelection()
3+
{
4+
if (present.microSd && !present.mosaicMicroSd)
5+
menuLog();
6+
if (!present.microSd && present.mosaicMicroSd)
7+
menuLogMosaic();
8+
if (present.microSd && present.mosaicMicroSd)
9+
{
10+
while (1)
11+
{
12+
systemPrintln();
13+
systemPrintln("Menu: Logging");
14+
systemPrintln();
15+
16+
systemPrintln("Accessible microSD:");
17+
printMicroSdInfo();
18+
systemPrintln();
19+
#ifdef COMPILE_MOSAICX5
20+
systemPrintln("Internal mosaic microSD:");
21+
printMosaicCardSpace();
22+
systemPrintln();
23+
#endif
24+
systemPrintln("1) Accessible microSD logging");
25+
systemPrintln("2) Internal mosaic microSD logging");
26+
27+
systemPrintln("x) Exit");
28+
29+
int incoming = getUserInputNumber(); // Returns EXIT, TIMEOUT, or long
30+
31+
if (incoming == 1)
32+
menuLog();
33+
#ifdef COMPILE_MOSAICX5
34+
else if (incoming == 2)
35+
menuLogMosaic();
36+
#endif
37+
else if (incoming == 'x')
38+
break;
39+
else if (incoming == INPUT_RESPONSE_GETNUMBER_EXIT)
40+
break;
41+
else if (incoming == INPUT_RESPONSE_GETNUMBER_TIMEOUT)
42+
break;
43+
else
44+
printUnknown(incoming);
45+
}
46+
clearBuffer(); // Empty buffer of any newline chars
47+
}
48+
}
49+
50+
// Print accessible microSd size and free space
51+
void printMicroSdInfo()
52+
{
53+
if (settings.enableSD && online.microSD)
54+
{
55+
char sdCardSizeChar[20];
56+
String cardSize;
57+
stringHumanReadableSize(cardSize, sdCardSize);
58+
cardSize.toCharArray(sdCardSizeChar, sizeof(sdCardSizeChar));
59+
char sdFreeSpaceChar[20];
60+
String freeSpace;
61+
stringHumanReadableSize(freeSpace, sdFreeSpace);
62+
freeSpace.toCharArray(sdFreeSpaceChar, sizeof(sdFreeSpaceChar));
63+
64+
char myString[70];
65+
snprintf(myString, sizeof(myString), "SD card size: %s / Free space: %s", sdCardSizeChar, sdFreeSpaceChar);
66+
systemPrintln(myString);
67+
68+
if (online.logging)
69+
{
70+
systemPrintf("Current log file name: %s\r\n", logFileName);
71+
}
72+
}
73+
else
74+
systemPrintln("No microSD card is detected");
75+
76+
if (bufferOverruns)
77+
systemPrintf("Buffer overruns: %d\r\n", bufferOverruns);
78+
}
79+
180
// Control the messages that get logged to SD
281
// Control max logging time (limit to a certain number of minutes)
382
// The main use case is the setup for a base station to log RAW sentences that then get post processed
@@ -7,32 +86,10 @@ void menuLog()
786
{
887
systemPrintln();
988
systemPrintln("Menu: Logging");
89+
systemPrintln();
1090

11-
if (settings.enableSD && online.microSD)
12-
{
13-
char sdCardSizeChar[20];
14-
String cardSize;
15-
stringHumanReadableSize(cardSize, sdCardSize);
16-
cardSize.toCharArray(sdCardSizeChar, sizeof(sdCardSizeChar));
17-
char sdFreeSpaceChar[20];
18-
String freeSpace;
19-
stringHumanReadableSize(freeSpace, sdFreeSpace);
20-
freeSpace.toCharArray(sdFreeSpaceChar, sizeof(sdFreeSpaceChar));
21-
22-
char myString[70];
23-
snprintf(myString, sizeof(myString), "SD card size: %s / Free space: %s", sdCardSizeChar, sdFreeSpaceChar);
24-
systemPrintln(myString);
25-
26-
if (online.logging)
27-
{
28-
systemPrintf("Current log file name: %s\r\n", logFileName);
29-
}
30-
}
31-
else
32-
systemPrintln("No microSD card is detected");
33-
34-
if (bufferOverruns)
35-
systemPrintf("Buffer overruns: %d\r\n", bufferOverruns);
91+
printMicroSdInfo();
92+
systemPrintln();
3693

3794
systemPrint("1) Log to microSD: ");
3895
if (settings.enableLogging == true)

0 commit comments

Comments
 (0)