// UBX-CFG-RATE (0x06 0x08) Set Navigation/Measurement Rate Settings (100ms=10.00Hz, 200ms=5.00Hz, 1000ms=1.00Hz, Etc)
// Generate the configuration command's syntax
void UBLOX::SetRATE(uint16_t measRate, uint16_t navRate, bool printACK) {
bool Supported = false;
if ( printACK == true ) {
Serial.print("Setting CFG-RATE (0x06 0x08) Navigation/Measurement Rate ");
_pACK_RATE = true; // print ACK to USB
}
// Possible Configurations
// _______________________________________________________________
// 60ms 16.67Hz <-- | 192ms 5.21Hz | 600ms 1.67Hz
// 64ms 15.63Hz <-- | 200ms 5.00Hz <-- | 625ms 1.60Hz
// 72ms 13.89Hz <-- | 225ms 4.44Hz | 640ms 1.56Hz
// 75ms 13.33Hz <-- | 240ms 4.17Hz | 720ms 1.39Hz
// 80ms 12.50Hz <-- | 250ms 4.00Hz <-- | 750ms 1.33Hz
// 90ms 11.11Hz | 288ms 3.47Hz | 800ms 1.25Hz <--
// 96ms 10.42Hz | 300ms 3.33Hz | 900ms 1.11Hz
// 100ms 10.00Hz <-- | 320ms 3.13Hz | 960ms 1.04Hz
// 120ms 8.33Hz | 360ms 2.78Hz | 1000ms 1.00Hz <--
// 125ms 8.00Hz <-- | 375ms 2.67Hz | 2000ms 0.50Hz <--
// 128ms 7.81Hz | 400ms 2.50Hz <-- | 4000ms 0.25Hz <--
// 144ms 6.94Hz | 450ms 2.22Hz | 10000ms 0.10Hz <--
// 150ms 6.67Hz | 480ms 2.08Hz | 20000ms 0.05Hz <--
// 160ms 6.25Hz | 500ms 2.00Hz <-- | 50000ms 0.02Hz <--
// 180ms 5.56Hz | 576ms 1.74Hz |
// NOTE: Only rate settings marked with arrows are the implemented configuration.
switch (measRate) {
case 60:
Supported = true;
if ( printACK == true ) {
Serial.println("60ms 16.67Hz");
}
break;
case 64:
Supported = true;
if ( printACK == true ) {
Serial.println("64ms 15.63Hz");
}
break;
case 72:
Supported = true;
if ( printACK == true ) {
Serial.println("72ms 13.89Hz");
}
break;
case 80:
Supported = true;
if ( printACK == true ) {
Serial.println("80ms 12.50Hz");
}
break;
case 100:
Supported = true;
if ( printACK == true ) {
Serial.println("100ms 10.00Hz");
}
break;
case 125:
Supported = true;
if ( printACK == true ) {
Serial.println("125ms 8.00Hz");
}
break;
case 200:
Supported = true;
if ( printACK == true ) {
Serial.println("200ms 5.00Hz");
}
break;
case 250:
Supported = true;
if ( printACK == true ) {
Serial.println("250ms 4.00Hz");
}
break;
case 400:
Supported = true;
if ( printACK == true ) {
Serial.println("400ms 2.50Hz");
}
break;
case 500:
Supported = true;
if ( printACK == true ) {
Serial.println("500ms 2.00Hz");
}
break;
case 800:
Supported = true;
if ( printACK == true ) {
Serial.println("800ms 1.25Hz");
}
break;
case 1000:
Supported = true;
if ( printACK == true ) {
Serial.println("1000ms 1.00Hz");
}
break;
case 2000:
Supported = true;
if ( printACK == true ) {
Serial.println("2000ms 0.50Hz");
}
break;
case 4000:
Supported = true;
if ( printACK == true ) {
Serial.println("4000ms 0.25Hz");
}
break;
case 10000:
Supported = true;
if ( printACK == true ) {
Serial.println("10000ms 0.10Hz");
}
break;
case 20000:
Supported = true;
if ( printACK == true ) {
Serial.println("20000ms 0.05Hz");
}
break;
case 50000:
Supported = true;
if ( printACK == true ) {
Serial.println("50000ms 0.02Hz");
}
break;
default:
Supported = false;
_pACK_RATE = false;
Serial.print("\tNot Supported :"), Serial.println(measRate), Serial.println("\tPossible Configurations");
Serial.println("\t60=16.67Hz 64=15.63Hz 72=13.89Hz 80=12.50Hz 100=10.00Hz 125=8.00Hz 200=5.00Hz 250=4.00Hz 500=2.00Hz");
Serial.println("\t800=1.25Hz 1000=1.00Hz 2000=0.50Hz 4000=0.25Hz 10000=0.10Hz 20000=0.05Hz 50000=0.02Hz "), Serial.println();
break;
}
if ( Supported == true ) {
// Splitting an uint16_t measRate
// Identifier & res0 - 16bit Parameter defines the rate. e.g. 100ms => 10Hz, 1000ms => 1Hz, 10000ms => 0.1Hz.
uint8_t res0 = ((measRate & 0xFF00) >> 8);
uint8_t Identifier = (measRate & 0x00FF);
uint8_t CLASS = 0x06, ID = 0x08, Length0 = 0x06, Length1 = 0x00;
uint8_t Par0 = navRate, Par1 = 0x00, Par2 = 0x01, Par3 = 0x00; // navRate and timeRef Parameters.
uint32_t P32t0 = 0, P32t1 = 0; // not used for this command
writeCommand(CLASS, ID, Length0, Length1, Identifier, res0, Par0, Par1, Par2, Par3, P32t0, P32t1);
}
}