Skip to content

Commit 216ae84

Browse files
committed
Show bubble menu based on accel online
1 parent ba99d2c commit 216ae84

File tree

2 files changed

+184
-52
lines changed

2 files changed

+184
-52
lines changed

Firmware/RTK_Surveyor/Display.ino

Lines changed: 156 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,45 +2218,106 @@ void paintDisplaySetup()
22182218
{
22192219
if (setupState == STATE_MARK_EVENT)
22202220
{
2221-
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, true); //string, y, font type, kerning, inverted
2222-
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2223-
printTextCenter("Base", 12 * 2, QW_FONT_8X16, 1, false);
2224-
printTextCenter("Bubble", 12 * 3, QW_FONT_8X16, 1, false);
2221+
if (online.accelerometer)
2222+
{
2223+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, true); //string, y, font type, kerning, inverted
2224+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2225+
printTextCenter("Base", 12 * 2, QW_FONT_8X16, 1, false);
2226+
printTextCenter("Bubble", 12 * 3, QW_FONT_8X16, 1, false);
2227+
}
2228+
else
2229+
{
2230+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, true); //string, y, font type, kerning, inverted
2231+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2232+
printTextCenter("Base", 12 * 2, QW_FONT_8X16, 1, false);
2233+
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, false);
2234+
}
22252235
}
22262236
else if (setupState == STATE_ROVER_NOT_STARTED)
22272237
{
2228-
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2229-
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, true);
2230-
printTextCenter("Base", 12 * 2, QW_FONT_8X16, 1, false);
2231-
printTextCenter("Bubble", 12 * 3, QW_FONT_8X16, 1, false);
2238+
if (online.accelerometer)
2239+
{
2240+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2241+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, true);
2242+
printTextCenter("Base", 12 * 2, QW_FONT_8X16, 1, false);
2243+
printTextCenter("Bubble", 12 * 3, QW_FONT_8X16, 1, false);
2244+
}
2245+
else
2246+
{
2247+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2248+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, true);
2249+
printTextCenter("Base", 12 * 2, QW_FONT_8X16, 1, false);
2250+
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, false);
2251+
}
22322252
}
22332253
else if (setupState == STATE_BASE_NOT_STARTED)
22342254
{
2235-
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false); //string, y, font type, kerning, inverted
2236-
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2237-
printTextCenter("Base", 12 * 2, QW_FONT_8X16, 1, true);
2238-
printTextCenter("Bubble", 12 * 3, QW_FONT_8X16, 1, false);
2255+
if (online.accelerometer)
2256+
{
2257+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false); //string, y, font type, kerning, inverted
2258+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2259+
printTextCenter("Base", 12 * 2, QW_FONT_8X16, 1, true);
2260+
printTextCenter("Bubble", 12 * 3, QW_FONT_8X16, 1, false);
2261+
}
2262+
else
2263+
{
2264+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false); //string, y, font type, kerning, inverted
2265+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2266+
printTextCenter("Base", 12 * 2, QW_FONT_8X16, 1, true);
2267+
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, false);
2268+
}
22392269
}
22402270
else if (setupState == STATE_BUBBLE_LEVEL)
22412271
{
2242-
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false); //string, y, font type, kerning, inverted
2243-
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2244-
printTextCenter("Base", 12 * 2, QW_FONT_8X16, 1, false);
2245-
printTextCenter("Bubble", 12 * 3, QW_FONT_8X16, 1, true);
2272+
if (online.accelerometer)
2273+
{
2274+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false); //string, y, font type, kerning, inverted
2275+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2276+
printTextCenter("Base", 12 * 2, QW_FONT_8X16, 1, false);
2277+
printTextCenter("Bubble", 12 * 3, QW_FONT_8X16, 1, true);
2278+
}
2279+
else
2280+
{
2281+
//We should never get here, but just in case
2282+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false); //string, y, font type, kerning, inverted
2283+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2284+
printTextCenter("Base", 12 * 2, QW_FONT_8X16, 1, false);
2285+
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, true);
2286+
}
22462287
}
22472288
else if (setupState == STATE_WIFI_CONFIG_NOT_STARTED)
22482289
{
2249-
printTextCenter("Rover", 12 * 0, QW_FONT_8X16, 1, false);
2250-
printTextCenter("Base", 12 * 1, QW_FONT_8X16, 1, false);
2251-
printTextCenter("Bubble", 12 * 2, QW_FONT_8X16, 1, false);
2252-
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, true);
2290+
if (online.accelerometer)
2291+
{
2292+
printTextCenter("Rover", 12 * 0, QW_FONT_8X16, 1, false);
2293+
printTextCenter("Base", 12 * 1, QW_FONT_8X16, 1, false);
2294+
printTextCenter("Bubble", 12 * 2, QW_FONT_8X16, 1, false);
2295+
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, true);
2296+
}
2297+
else
2298+
{
2299+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2300+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2301+
printTextCenter("Base", 12 * 2, QW_FONT_8X16, 1, false);
2302+
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, true);
2303+
}
22532304
}
22542305
else if (setupState == STATE_ESPNOW_PAIRING_NOT_STARTED)
22552306
{
2256-
printTextCenter("Base", 12 * 0, QW_FONT_8X16, 1, false);
2257-
printTextCenter("Bubble", 12 * 1, QW_FONT_8X16, 1, false);
2258-
printTextCenter("Config", 12 * 2, QW_FONT_8X16, 1, false);
2259-
printTextCenter("E-Pair", 12 * 3, QW_FONT_8X16, 1, true);
2307+
if (online.accelerometer)
2308+
{
2309+
printTextCenter("Base", 12 * 0, QW_FONT_8X16, 1, false);
2310+
printTextCenter("Bubble", 12 * 1, QW_FONT_8X16, 1, false);
2311+
printTextCenter("Config", 12 * 2, QW_FONT_8X16, 1, false);
2312+
printTextCenter("E-Pair", 12 * 3, QW_FONT_8X16, 1, true);
2313+
}
2314+
else
2315+
{
2316+
printTextCenter("Rover", 12 * 0, QW_FONT_8X16, 1, false);
2317+
printTextCenter("Base", 12 * 1, QW_FONT_8X16, 1, false);
2318+
printTextCenter("Config", 12 * 2, QW_FONT_8X16, 1, false);
2319+
printTextCenter("E-Pair", 12 * 3, QW_FONT_8X16, 1, true);
2320+
}
22602321
}
22612322
else if (setupState == STATE_PROFILE)
22622323
paintDisplaySetupProfile("Base");
@@ -2265,38 +2326,89 @@ void paintDisplaySetup()
22652326
{
22662327
if (setupState == STATE_MARK_EVENT)
22672328
{
2268-
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, true); //string, y, font type, kerning, inverted
2269-
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2270-
printTextCenter("Bubble", 12 * 2, QW_FONT_8X16, 1, false);
2271-
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, false);
2329+
if (online.accelerometer)
2330+
{
2331+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, true); //string, y, font type, kerning, inverted
2332+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2333+
printTextCenter("Bubble", 12 * 2, QW_FONT_8X16, 1, false);
2334+
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, false);
2335+
}
2336+
else
2337+
{
2338+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, true); //string, y, font type, kerning, inverted
2339+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2340+
printTextCenter("Config", 12 * 2, QW_FONT_8X16, 1, false);
2341+
printTextCenter("E-Pair", 12 * 3, QW_FONT_8X16, 1, false);
2342+
}
22722343
}
22732344
else if (setupState == STATE_ROVER_NOT_STARTED)
22742345
{
2275-
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2276-
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, true);
2277-
printTextCenter("Bubble", 12 * 2, QW_FONT_8X16, 1, false);
2278-
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, false);
2346+
if (online.accelerometer)
2347+
{
2348+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2349+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, true);
2350+
printTextCenter("Bubble", 12 * 2, QW_FONT_8X16, 1, false);
2351+
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, false);
2352+
}
2353+
else
2354+
{
2355+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2356+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, true);
2357+
printTextCenter("Config", 12 * 2, QW_FONT_8X16, 1, false);
2358+
printTextCenter("E-Pair", 12 * 3, QW_FONT_8X16, 1, false);
2359+
}
22792360
}
22802361
else if (setupState == STATE_BUBBLE_LEVEL)
22812362
{
2282-
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2283-
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2284-
printTextCenter("Bubble", 12 * 2, QW_FONT_8X16, 1, true);
2285-
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, false);
2363+
if (online.accelerometer)
2364+
{
2365+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2366+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2367+
printTextCenter("Bubble", 12 * 2, QW_FONT_8X16, 1, true);
2368+
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, false);
2369+
}
2370+
else
2371+
{
2372+
//We should never get here, but just in case
2373+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2374+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2375+
printTextCenter("Config", 12 * 2, QW_FONT_8X16, 1, true);
2376+
printTextCenter("E-Pair", 12 * 3, QW_FONT_8X16, 1, false);
2377+
}
22862378
}
22872379
else if (setupState == STATE_WIFI_CONFIG_NOT_STARTED)
22882380
{
2289-
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2290-
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2291-
printTextCenter("Bubble", 12 * 2, QW_FONT_8X16, 1, false);
2292-
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, true);
2381+
if (online.accelerometer)
2382+
{
2383+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2384+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2385+
printTextCenter("Bubble", 12 * 2, QW_FONT_8X16, 1, false);
2386+
printTextCenter("Config", 12 * 3, QW_FONT_8X16, 1, true);
2387+
}
2388+
else
2389+
{
2390+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2391+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2392+
printTextCenter("Config", 12 * 2, QW_FONT_8X16, 1, true);
2393+
printTextCenter("E-Pair", 12 * 3, QW_FONT_8X16, 1, false);
2394+
}
22932395
}
22942396
else if (setupState == STATE_ESPNOW_PAIRING_NOT_STARTED)
22952397
{
2296-
printTextCenter("Rover", 12 * 0, QW_FONT_8X16, 1, false);
2297-
printTextCenter("Bubble", 12 * 1, QW_FONT_8X16, 1, false);
2298-
printTextCenter("Config", 12 * 2, QW_FONT_8X16, 1, false);
2299-
printTextCenter("E-Pair", 12 * 3, QW_FONT_8X16, 1, true);
2398+
if (online.accelerometer)
2399+
{
2400+
printTextCenter("Rover", 12 * 0, QW_FONT_8X16, 1, false);
2401+
printTextCenter("Bubble", 12 * 1, QW_FONT_8X16, 1, false);
2402+
printTextCenter("Config", 12 * 2, QW_FONT_8X16, 1, false);
2403+
printTextCenter("E-Pair", 12 * 3, QW_FONT_8X16, 1, true);
2404+
}
2405+
else
2406+
{
2407+
printTextCenter("Mark", 12 * 0, QW_FONT_8X16, 1, false);
2408+
printTextCenter("Rover", 12 * 1, QW_FONT_8X16, 1, false);
2409+
printTextCenter("Config", 12 * 2, QW_FONT_8X16, 1, false);
2410+
printTextCenter("E-Pair", 12 * 3, QW_FONT_8X16, 1, true);
2411+
}
23002412
}
23012413
else if (setupState == STATE_PROFILE)
23022414
paintDisplaySetupProfile("Rover");

Firmware/RTK_Surveyor/Tasks.ino

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ void handleGNSSDataTask(void *e)
359359

360360
sdBytesToRecord = ubxFile->write(&ringBuffer[sdTail], sliceToRecord);
361361
fileSize = ubxFile->fileSize(); //Update file size
362-
362+
363363
sdFreeSpace -= sliceToRecord; //Update remaining space on SD
364364

365365
//Force file sync every 60s
@@ -637,12 +637,22 @@ void ButtonCheckTask(void *e)
637637
case STATE_ROVER_NOT_STARTED:
638638
//If F9R, skip base state
639639
if (zedModuleType == PLATFORM_F9R)
640-
setupState = STATE_BUBBLE_LEVEL;
640+
{
641+
//If accel offline, skip bubble
642+
if (online.accelerometer == true)
643+
setupState = STATE_BUBBLE_LEVEL;
644+
else
645+
setupState = STATE_WIFI_CONFIG_NOT_STARTED;
646+
}
641647
else
642648
setupState = STATE_BASE_NOT_STARTED;
643649
break;
644650
case STATE_BASE_NOT_STARTED:
645-
setupState = STATE_BUBBLE_LEVEL;
651+
//If accel offline, skip bubble
652+
if (online.accelerometer == true)
653+
setupState = STATE_BUBBLE_LEVEL;
654+
else
655+
setupState = STATE_WIFI_CONFIG_NOT_STARTED;
646656
break;
647657
case STATE_BUBBLE_LEVEL:
648658
setupState = STATE_WIFI_CONFIG_NOT_STARTED;
@@ -759,12 +769,22 @@ void ButtonCheckTask(void *e)
759769
case STATE_ROVER_NOT_STARTED:
760770
//If F9R, skip base state
761771
if (zedModuleType == PLATFORM_F9R)
762-
setupState = STATE_BUBBLE_LEVEL;
772+
{
773+
//If accel offline, skip bubble
774+
if (online.accelerometer == true)
775+
setupState = STATE_BUBBLE_LEVEL;
776+
else
777+
setupState = STATE_WIFI_CONFIG_NOT_STARTED;
778+
}
763779
else
764780
setupState = STATE_BASE_NOT_STARTED;
765781
break;
766782
case STATE_BASE_NOT_STARTED:
767-
setupState = STATE_BUBBLE_LEVEL;
783+
//If accel offline, skip bubble
784+
if (online.accelerometer == true)
785+
setupState = STATE_BUBBLE_LEVEL;
786+
else
787+
setupState = STATE_WIFI_CONFIG_NOT_STARTED;
768788
break;
769789
case STATE_BUBBLE_LEVEL:
770790
setupState = STATE_WIFI_CONFIG_NOT_STARTED;
@@ -944,9 +964,9 @@ void sdSizeCheckTask(void *e)
944964
//uint64_t sdUsedSpace = sdCardSize - sdFreeSpace; //Don't think of it as used, think of it as unusable
945965

946966
systemPrintf("SD card size: %s / Free space: %s\r\n",
947-
stringHumanReadableSize(sdCardSize),
948-
stringHumanReadableSize(sdFreeSpace)
949-
);
967+
stringHumanReadableSize(sdCardSize),
968+
stringHumanReadableSize(sdFreeSpace)
969+
);
950970

951971
outOfSDSpace = false;
952972

0 commit comments

Comments
 (0)