Skip to content

Commit 416afc0

Browse files
authored
Merge pull request #13 from LeeLeahy2/ex-8-error
Example 8: Display error message when things fail
2 parents 2c5238a + d7dfc0b commit 416afc0

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

examples/Example8_SetConstellations/Example8_SetConstellations.ino

+27-5
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,33 @@ void setup()
5858

5959
//We can batch commands together and check the overall success
6060
bool response = true;
61-
response &= myGNSS.enableConstellation("BDS");
62-
response &= myGNSS.enableConstellation("GAL");
63-
response &= myGNSS.disableConstellation("GLO");
64-
response &= myGNSS.enableConstellation("QZSS");
65-
response &= myGNSS.saveConfiguration(); //Save the current configuration into non-volatile memory (NVM)
61+
if (!myGNSS.enableConstellation("BDS"))
62+
{
63+
response = false;
64+
Serial.println("Failed to enable BDS constellation");
65+
}
66+
if (!myGNSS.enableConstellation("GAL"))
67+
{
68+
response = false;
69+
Serial.println("Failed to enable GAL constellation");
70+
}
71+
if (!myGNSS.disableConstellation("GLO"))
72+
{
73+
response = false;
74+
Serial.println("Failed to disable GLO constellation");
75+
}
76+
if (!myGNSS.enableConstellation("QZSS"))
77+
{
78+
response = false;
79+
Serial.println("Failed to enable QZSS constellation");
80+
}
81+
82+
//Save the current configuration into non-volatile memory (NVM)
83+
if (!myGNSS.saveConfiguration())
84+
{
85+
response = false;
86+
Serial.println("Failed to save the configuration");
87+
}
6688

6789
if (response == true)
6890
Serial.println("Configuration complete!");

0 commit comments

Comments
 (0)