Skip to content

Commit 77a6089

Browse files
committed
Add text menus for Sensor Fusion config. Add icon for Fusion state.
1 parent 96e198b commit 77a6089

File tree

9 files changed

+132
-10
lines changed

9 files changed

+132
-10
lines changed

Firmware/RTK_Surveyor/Display.ino

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,43 @@ void paintBaseState()
321321
systemState == STATE_ROVER_RTK_FLOAT ||
322322
systemState == STATE_ROVER_RTK_FIX)
323323
{
324-
oled.drawIcon(27, 3, Rover_Width, Rover_Height, Rover, sizeof(Rover), true);
324+
//Normal rover for ZED-F9P, fusion rover for ZED-F9R
325+
if (zedModuleType == PLATFORM_F9P)
326+
{
327+
oled.drawIcon(27, 3, Rover_Width, Rover_Height, Rover, sizeof(Rover), true);
328+
}
329+
else if (zedModuleType == PLATFORM_F9R)
330+
{
331+
//Blink fusion rover until we have calibration
332+
i2cGNSS.getEsfInfo(); // Poll new ESF STATUS data
333+
if (i2cGNSS.packetUBXESFSTATUS->data.fusionMode == 0) //Initializing
334+
{
335+
//Blink Fusion Rover icon until sensor calibration is complete
336+
if (millis() - lastBaseIconUpdate > 500)
337+
{
338+
lastBaseIconUpdate = millis();
339+
if (baseIconDisplayed == false)
340+
{
341+
baseIconDisplayed = true;
342+
343+
//Draw the icon
344+
oled.drawIcon(27, 2, Rover_Fusion_Width, Rover_Fusion_Height, Rover_Fusion, sizeof(Rover_Fusion), true);
345+
}
346+
else
347+
baseIconDisplayed = false;
348+
}
349+
}
350+
else if (i2cGNSS.packetUBXESFSTATUS->data.fusionMode == 1) //Calibrated
351+
{
352+
//Solid fusion rover
353+
oled.drawIcon(27, 2, Rover_Fusion_Width, Rover_Fusion_Height, Rover_Fusion, sizeof(Rover_Fusion), true);
354+
}
355+
else if (i2cGNSS.packetUBXESFSTATUS->data.fusionMode == 2 || i2cGNSS.packetUBXESFSTATUS->data.fusionMode == 3) //Suspended or disabled
356+
{
357+
//Empty rover
358+
oled.drawIcon(27, 2, Rover_Fusion_Empty_Width, Rover_Fusion_Empty_Height, Rover_Fusion_Empty, sizeof(Rover_Fusion_Empty), true);
359+
}
360+
}
325361
}
326362
else if (systemState == STATE_BASE_TEMP_SETTLE ||
327363
systemState == STATE_BASE_TEMP_SURVEY_STARTED //Turn on base icon solid (blink crosshair in paintHorzAcc)
@@ -370,7 +406,7 @@ void paintSIV()
370406
if (online.display == true)
371407
{
372408
//Blink satellite dish icon if we don't have a fix
373-
if (i2cGNSS.getFixType() == 3 || i2cGNSS.getFixType() == 5) //3D or Time
409+
if (i2cGNSS.getFixType() == 3 || i2cGNSS.getFixType() == 4 || i2cGNSS.getFixType() == 5) //3D, 3D+DR, or Time
374410
{
375411
//Fix, turn on icon
376412
oled.drawIcon(2, 35, Antenna_Width, Antenna_Height, Antenna, sizeof(Antenna), true);

Firmware/RTK_Surveyor/NVM.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ void recordSystemSettingsToFile()
139139
settingsFile.println("dynamicModel=" + (String)settings.dynamicModel);
140140
settingsFile.println("lastState=" + (String)settings.lastState);
141141
settingsFile.println("throttleDuringSPPCongestion=" + (String)settings.throttleDuringSPPCongestion);
142+
settingsFile.println("autoIMUmountAlignment=" + (String)settings.autoIMUmountAlignment);
142143

143144
//Record constellation settings
144145
for (int x = 0 ; x < MAX_CONSTELLATIONS ; x++)
@@ -402,6 +403,8 @@ bool parseLine(char* str) {
402403
settings.lastState = (SystemState)d;
403404
else if (strcmp(settingName, "throttleDuringSPPCongestion") == 0)
404405
settings.throttleDuringSPPCongestion = d;
406+
else if (strcmp(settingName, "autoIMUmountAlignment") == 0)
407+
settings.autoIMUmountAlignment = d;
405408

406409
//Check for bulk settings (constellations and message rates)
407410
//Must be last on else list

Firmware/RTK_Surveyor/Rover.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ bool configureUbloxModuleRover()
4242
Serial.println(F("setNMEASettings failed"));
4343

4444
response = true; //Reset
45+
if (zedModuleType == PLATFORM_F9R)
46+
{
47+
i2cGNSS.setESFAutoAlignment(settings.autoIMUmountAlignment); //Configure UBX-CFG-ESFALG Automatic IMU-mount Alignment
48+
}
4549

4650
//The last thing we do is set output rate.
4751
response = true; //Reset

Firmware/RTK_Surveyor/icons.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@ uint8_t Rover [] = {
4848
int Rover_Height = 8;
4949
int Rover_Width = 15;
5050

51+
uint8_t Rover_Fusion [] = {
52+
0x3E, 0xC1, 0x21, 0x21, 0xC1, 0x7D, 0x55, 0x55, 0x45, 0x41, 0xC2, 0x24, 0x24, 0xC4, 0x3C, 0x00,
53+
0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00,
54+
};
55+
int Rover_Fusion_Height = 9;
56+
int Rover_Fusion_Width = 15;
57+
58+
uint8_t Rover_Fusion_Empty [] = {
59+
0x3E, 0xC1, 0x21, 0x21, 0xC1, 0x41, 0x41, 0x41, 0x41, 0x41, 0xC2, 0x24, 0x24, 0xC4, 0x3C, 0x00,
60+
0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00,
61+
};
62+
int Rover_Fusion_Empty_Height = 9;
63+
int Rover_Fusion_Empty_Width = 15;
64+
5165
uint8_t BaseTemporary [] = {
5266
0x00, 0xFF, 0x99, 0x99, 0xE7, 0xCE, 0x32, 0x32, 0xE7, 0xE7, 0x99, 0x32, 0xFE, 0x00, 0x00, 0x1F,
5367
0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00,

Firmware/RTK_Surveyor/menuBase.ino

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
void menuBase()
44
{
55
int menuTimeoutExtended = 30; //Increase time needed for complex data entry (mount point ID, ECEF coords, etc).
6-
6+
77
while (1)
88
{
99
Serial.println();
@@ -216,3 +216,51 @@ void menuBase()
216216

217217
while (Serial.available()) Serial.read(); //Empty buffer of any newline chars
218218
}
219+
220+
//Configure ESF settings
221+
void menuSensorFusion()
222+
{
223+
while (1)
224+
{
225+
Serial.println();
226+
Serial.println(F("Menu: Sensor Fusion Menu"));
227+
228+
if (i2cGNSS.getEsfInfo()) // Poll new ESF STATUS data
229+
{
230+
Serial.print(F("Fusion Mode: "));
231+
Serial.print(i2cGNSS.packetUBXESFSTATUS->data.fusionMode);
232+
if (i2cGNSS.packetUBXESFSTATUS->data.fusionMode == 0)
233+
Serial.println(F("Initializing"));
234+
else if (i2cGNSS.packetUBXESFSTATUS->data.fusionMode == 1)
235+
Serial.println(F("Calibrated"));
236+
else if (i2cGNSS.packetUBXESFSTATUS->data.fusionMode == 2)
237+
Serial.println(F("Suspended"));
238+
else if (i2cGNSS.packetUBXESFSTATUS->data.fusionMode == 3)
239+
Serial.println(F("Disabled"));
240+
}
241+
242+
Serial.print(F("1) Toggle Automatic IMU-mount Alignment: "));
243+
if (settings.autoIMUmountAlignment == true) Serial.println(F("Enabled"));
244+
else Serial.println(F("Disabled"));
245+
246+
Serial.println(F("x) Exit"));
247+
248+
int incoming = getNumber(menuTimeout); //Timeout after x seconds
249+
250+
if (incoming == 1)
251+
{
252+
settings.autoIMUmountAlignment ^= 1;
253+
}
254+
255+
else if (incoming == STATUS_PRESSED_X)
256+
break;
257+
else if (incoming == STATUS_GETNUMBER_TIMEOUT)
258+
break;
259+
else
260+
printUnknown(incoming);
261+
}
262+
263+
i2cGNSS.setESFAutoAlignment(settings.autoIMUmountAlignment); //Configure UBX-CFG-ESFALG Automatic IMU-mount Alignment
264+
265+
while (Serial.available()) Serial.read(); //Empty buffer of any newline chars
266+
}

Firmware/RTK_Surveyor/menuMain.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ void menuMain()
2121

2222
if (zedModuleType == PLATFORM_F9P)
2323
Serial.println(F("3) Configure Base"));
24+
else if (zedModuleType == PLATFORM_F9R)
25+
Serial.println(F("3) Configure Sensor Fusion"));
2426

2527
Serial.println(F("4) Configure Ports"));
2628

@@ -50,6 +52,8 @@ void menuMain()
5052
menuMessages();
5153
else if (incoming == '3' && zedModuleType == PLATFORM_F9P)
5254
menuBase();
55+
else if (incoming == '3' && zedModuleType == PLATFORM_F9R)
56+
menuSensorFusion();
5357
else if (incoming == '4')
5458
menuPorts();
5559
else if (incoming == '5')

Firmware/RTK_Surveyor/menuMessages.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ void menuMessages()
7777
Serial.println(F("1) Set NMEA Messages"));
7878
if (zedModuleType == PLATFORM_F9P)
7979
Serial.println(F("2) Set RTCM Messages"));
80+
else if (zedModuleType == PLATFORM_F9R)
81+
Serial.println(F("2) Set ESF Messages"));
8082
Serial.println(F("3) Set RXM Messages"));
8183
Serial.println(F("4) Set NAV Messages"));
8284
Serial.println(F("5) Set MON Messages"));
@@ -94,6 +96,8 @@ void menuMessages()
9496
menuMessagesSubtype("NMEA");
9597
else if (incoming == 2 && zedModuleType == PLATFORM_F9P)
9698
menuMessagesSubtype("RTCM");
99+
else if (incoming == 2 && zedModuleType == PLATFORM_F9R)
100+
menuMessagesSubtype("ESF");
97101
else if (incoming == 3)
98102
menuMessagesSubtype("RXM");
99103
else if (incoming == 4)

Firmware/RTK_Surveyor/menuPorts.ino

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
void menuPorts()
22
{
3-
if(productVariant == RTK_SURVEYOR)
3+
if (productVariant == RTK_SURVEYOR)
44
menuPortsSurveyor();
5-
else if(productVariant == RTK_EXPRESS || productVariant == RTK_EXPRESS_PLUS)
5+
else if (productVariant == RTK_EXPRESS || productVariant == RTK_EXPRESS_PLUS)
66
menuPortsExpress();
77
}
88

@@ -83,8 +83,13 @@ void menuPortsExpress()
8383
Serial.println(F("NMEA TX Out/RX In"));
8484
else if (settings.dataPortChannel == MUX_PPS_EVENTTRIGGER)
8585
Serial.println(F("PPS OUT/Event Trigger In"));
86-
else if (settings.dataPortChannel == MUX_I2C)
87-
Serial.println(F("I2C SDA/SCL"));
86+
else if (settings.dataPortChannel == MUX_I2C_WT)
87+
{
88+
if (zedModuleType == PLATFORM_F9P)
89+
Serial.println(F("I2C SDA/SCL"));
90+
else if (zedModuleType == PLATFORM_F9R)
91+
Serial.println(F("Wheel Tick/Direction"));
92+
}
8893
else if (settings.dataPortChannel == MUX_ADC_DAC)
8994
Serial.println(F("ESP32 DAC Out/ADC In"));
9095

@@ -119,9 +124,12 @@ void menuPortsExpress()
119124
Serial.println(F("\n\rEnter the pin connection to use (1 to 4) for Data Port: "));
120125
Serial.println(F("1) NMEA TX Out/RX In"));
121126
Serial.println(F("2) PPS OUT/Event Trigger In"));
122-
Serial.println(F("3) I2C SDA/SCL"));
127+
if (zedModuleType == PLATFORM_F9P)
128+
Serial.println(F("3) I2C SDA/SCL"));
129+
else if (zedModuleType == PLATFORM_F9R)
130+
Serial.println(F("3) Wheel Tick/Direction"));
123131
Serial.println(F("4) ESP32 DAC Out/ADC In"));
124-
132+
125133
int muxPort = getNumber(menuTimeout); //Timeout after x seconds
126134
if (muxPort < 1 || muxPort > 4)
127135
{

Firmware/RTK_Surveyor/settings.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ typedef enum muxConnectionType_e
5959
{
6060
MUX_UBLOX_NMEA = 0,
6161
MUX_PPS_EVENTTRIGGER,
62-
MUX_I2C,
62+
MUX_I2C_WT,
6363
MUX_ADC_DAC,
6464
} muxConnectionType_e;
6565

@@ -332,6 +332,7 @@ struct struct_settings {
332332
SystemState lastState = STATE_ROVER_NOT_STARTED; //For Express, start unit in last known state
333333
bool throttleDuringSPPCongestion = true;
334334
ubxConstellation ubxConstellations; //Constellations monitored/used for fix
335+
bool autoIMUmountAlignment = true;
335336
} settings;
336337

337338
//These are the devices on board RTK Surveyor that may be on or offline.

0 commit comments

Comments
 (0)